@results = (''); foreach my $subarray (@array) { @results = map {my $res = $_; map $res.$_, @$subarray } @results; } print join "\n", @results,'';