in reply to Swap-a-roo

Here's another approach. It may not be cleaner, but it's closer to the Fisher-Yates shuffle recommended in the FAQ.
#!/usr/bin/perl -w use strict; my @set = (1 .. 9); my %point; my ($x, $y); # something for the last element left to point to my $last = $set[-1]; # prime the pump $x = pop @set; while (@set) { # grab something that's left $y = splice @set, ((rand @set) - 1), 1; $point{$x} = $y; # do that one next $x = $y; } # take care of that straggler $point{$x} = $last; # and now a demo foreach my $key (keys %point) { print "$key points to ", $point{$key}, "\n"; }