%perms = ();
sub Permute
{
my $depth = shift;
my $i;
if ($depth == 0)
{
@stack = ();
}
for ($i = 0; $i <= $ {
$stack[$depth] = $set[$i];
if ($depth == $ {
%output = ();
foreach (@stack)
{
$output{$_}++;
}
$perm = join(" ", sort(keys(%output)));
$perms{$perm}++;
}
else
{
&Permute($depth + 1);
}
}
}
@maps = ([ '/$s$s', '/0s0o', '/2s2a', '/3s3e', '/5s5s', '/1s1i', '/4s4a' ],
[ '/$s$s', '/0s0o', '/2s2a', '/3s3e', '/5s5s', '/1s1i', '/4s4h' ],
[ '/$s$s', '/0s0o', '/2s2a', '/3s3e', '/5s5s', '/1s1l', '/4s4a' ],
[ '/$s$s', '/0s0o', '/2s2a', '/3s3e', '/5s5s', '/1s1l', '/4s4h' ]);
@set = (0 .. 5);
&Permute(0);
foreach $perm (sort(keys(%perms)))
{
foreach $aref (@maps)
{
foreach $i (split(" ", $perm))
{
print ${$aref}[$i];
}
print "\n";
}
}
exit 0;