|
|
| Pathologically Eclectic Rubbish Lister | |
| PerlMonks |
Re: Idiom to return 0 or random number of array elementsby bart (Canon) |
| on Dec 07, 2012 at 12:08 UTC ( #1007725=note: print w/ replies, xml ) | Need Help?? |
|
If the second parameter for the .. operator is lower than the first parameter, then you'll get no items. BTW this will not return a random number of random elements. Instead it'll return the first N elements where N is a random number. If you want random elements, you could shuffle the array first.
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||