[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 4:33 PM, Jay Hannah wrote:

print $a[int rand($#a + 1)];

because $#a is not the number of elements, its the highest index of @a.

All you really needs is @a[rand @a].

xoxo,
Andy

--
Andy Lester => andy@petdance.com => www.petdance.com => AIM:petdance