[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Omaha.pm] Pick a random array element ... beware the web experts :)




On Oct 23, 2006, at 7:00 PM, Andy Lester wrote:
All you really needs is @a[rand @a].

?!  Well... paint me pink and call me Sally...

$ cat j.pl
my @a = ("A", "B", "C");
for (1..50) {
   print @a[rand @a];
}
print "\n";

$ perl j.pl
BACCACACCCCBCABCBCABBCACCCCBCBCCBACCABCBABBAABCACC

Andy is some mad genius type!

Where do you hang out learning all this stuff?

j