my @combinations = ( "1,1","1,2","2,1","2,2") #### my @combinations; for my $i (1..2){ for my $j (1..2) { push @combinations, "$i,$j"; } }