in reply to Random array sorting
See merlyn's reply below.
sub shuffle { my @shuffled; push @shuffed, splice(@_, rand(@_), 1) while @_; return @shuffled; } print shuffle @array;
The splice pulls a random element out of the array, which is pushed onto the new array. Repeat while there are still elements in the list.
Makeshifts last the longest.
|
---|
In Section
Seekers of Perl Wisdom