sub comb{ return @{ $_[0] } if @_ == 1; map{ my $x = $_; map{ "$x$_" } comb( @_ ) } @{ shift() } } my @combs = comb [qw(a b c)],[qw(1 2 3)],[qw(- + *)];