DB<1> @array=qw/a b c d/ DB<2> $stringified = join ',', @array; DB<3> @permutations = glob "{$stringified}" x 2; DB<4> map {s/(.)(.)/$1-$2/} @permutations DB<5> x @permutations 0 'a-a' 1 'a-b' 2 'a-c' 3 'a-d' 4 'b-a' 5 'b-b' 6 'b-c' 7 'b-d' 8 'c-a' 9 'c-b' 10 'c-c' 11 'c-d' 12 'd-a' 13 'd-b' 14 'd-c' 15 'd-d'