[San-Diego-pm] Perl Meeting on Monday, May 9th

Randal L. Schwartz merlyn at stonehenge.com
Tue May 10 12:50:09 PDT 2005


>>>>> "Menolly" == Menolly  <menolly at mib.org> writes:

Menolly> $testDigest = @untaken[rand(@untaken)]->[0];

Menolly> Hmm, I thought we _did_ have -w turned on across the board.  But I don't
Menolly> think your syntax will work; @untaken is an array of arrayrefs; I need
Menolly> to select a random element from it, dereference that element, and set
Menolly> $testDigest to the first (and, as it happens, only) element of the
Menolly> referenced array.  (It's a ref because of DBI; it's a question of where
Menolly> I place the complexity.)

OK, that's

        $untaken[rand @untaken][0];

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn at stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


More information about the San-Diego-pm mailing list