So, you want to draw names out of a hat (say, for a gift exchange at the office) but you want to make sure that the draw path forms a cycle through all the names given:
#!/usr/bin/perl -w use strict; use Math::Random; @ARGV = random_permutation(@ARGV); print "$ARGV[$_] => $ARGV[$_ - 1]\n" for 0 .. $#ARGV;
|
|---|