my @a = (1 .. 10); print join("\t", @a),"\n"; #starting from the end and working back for ($i = $#a; $i > 0; $i--) { # pick a random guy to stuff in the ith slot $guy = int(rand($i + 1)); #snatch the guy out, and stuff him in! splice(@a, $i, 0, splice(@a, $guy, 1)); } print join("\t", @a),"\n";