In your example, the last breaks out of the inner for ($a), like it's supposed to. If you use given (which is actually the "switch" statement, not for, even though it can be used), the last does exit the outer foreach like you would expect.
given/when was introduced in Perl 5.10 (Dec 2007) and was retroactively marked experimental in Perl 5.16 (May 2012). While I personally liked given/when, I no longer use it because its implementation is now subject to change.
In reply to Re: using the feature 'switch' in loops
by Anonymous Monk
in thread using the feature 'switch' in loops
by martell
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |