my @set = qw(A B C); my $output = mk_tuples(@set, 2); #### A A A B A C B A B B B C C A C B C C