use feature "switch"; LOOP: foreach $a (1..2) { for ($a) { when (1) {print "1\n"; last LOOP;} when (2) {print "2\n"; last LOOP;} } }