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