my @lList = (1..10); my ($lPos, $lRand); # For every position in the list, swap it with a random # position earlier in the list. foreach $lPos (1..$#list) { $lRand = int(rand($lPos)); @lList[$lPos, $lRand] = @lList[$lRand, $lPos]; } #### my @lList = (1..10); my ($lPos, $lRand); # For every position in the list, swap it with a random # position earlier in the list. foreach $lPos (1..$#list) { $lRand = int(rand($lPos+1)); @lList[$lPos, $lRand] = @lList[$lRand, $lPos]; }