for my $digit (1 .. 3) { for my $char ('a' .. 'c') { next if $char eq 'b'; print "$digit $char\n"; } }