in reply to Creating tuples based on sets

You could use my code at Non- recursive permutation of arrays. like so.
my @elements = qw(a b c); my $tupler = make_permutator(([@elements]) x 2 ); while (my @tuple = $tupler->() ){ print @tuple,"\n"; }
If a ref return value is wanted, just change "return @els" to "return \@els" in the sub that make_permutator returns.

-Lee

"To be civilized is to deny one's nature."