foreach $l1 (@one) { foreach $l2 (@two) { foreach $l3 (@three) { $permutation = $l1 . $l2 . $l3; # Do whatever } } }