sub funcP { return [], rec(@_); } sub rec { return () unless @_; map { my $first = shift; [$first], map { [ $first, @$_ ] } rec(@_) } @_; }