my $iter = permutations(\@data); while (my $p = $iter->next) { print "@$p\n"; }