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

Jay Hannah jay at jays.net
Wed Oct 25 05:52:22 PDT 2006


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




More information about the Omaha-pm mailing list