foreach my $s1 (@set1) { foreach my $s2 (@set2) { foreach my $s3 (@sizes) { foreach my $s4 (@colors) { print "$s1$s2$s3$s4\n"; } } } } #### my @sku = qw/SKU1 SKU2 SKU3/; my @tslh = qw/t s l h/; my @colors = qw/BLU GRN WHT BLK /; my @sizes = qw / S M L XL 2X /; print map { $col = $_; map { $siz = $_; map {$a1 =$_; map "$_ $a1 $siz $col\n", @sku;} @tslh} @sizes } @colors; #### SKU1 t S BLU SKU2 t S BLU SKU3 t S BLU SKU1 s S BLU SKU2 s S BLU ... SKU3 l 2X BLK SKU1 h 2X BLK SKU2 h 2X BLK SKU3 h 2X BLK