http://www.perlmonks.org?node_id=635718


in reply to Desparate behavior in loop labels

Here is an example:
sub foo { print $_; last if $_ >= 3; } sub bar { for (1 .. 10) { foo; } } bar;
This script will stop printing after "3". This is because calling last from inside foo jumps out of the loop it's in, even though that loop is defined in bar. By contrast, in languages like C or Java, the equivalent calls (break and continue) are simply illegal outside loops.