in reply to Derangements iterator
Producing a single derangement (such as might be needed for a Secret Santa list) is just a matter of doing a rotation. Of course, you'd want to randomize the order first, to keep things secret:
Caution: Contents may have been coded under pressure.
use List::Util 'shuffle'; my @from = shuffle(@ARGV); print "$from[$_-1] => $from[$_]\n" for 0..$#from;
Caution: Contents may have been coded under pressure.
In Section
Cool Uses for Perl