last will exit the inner-most loop statement. Those are:
- BLOCK
- while (EXPR) BLOCK (or until)
- for (LIST) BLOCK (or foreach)
- for (EXPR..EXPR) BLOCK (or foreach)
- for (EXPR; EXPR; EXPR) BLOCK (or foreach)
Expressions with loop statement modifiers are not considered by last. The same goes for loop-like functions. These include the following:
- EXPR while EXPR; (or until): Expression with statement modifier. (Not a loop statement.)
EXPR for LIST; (or foreach): Expression with statement modifier. (Not a loop statement.) last actually does see this as a loop to end.
- grep BLOCK LIST: Not a statement.
- map BLOCK LIST: Not a statement.
All loop statements have braces, but not all braces are related to loop statements. The following are examples that aren't:
- if (EXPR) BLOCK (or unless): Not a loop.
- grep BLOCK LIST: Not a statement.
- map BLOCK LIST: Not a statement.
- do BLOCK: Not a loop or a statement.
- eval BLOCK: Not a loop or a statement.
- sub BLOCK: Not a loop or a statement.
- sub NAME [...] BLOCK: Not a loop.
If you want a warning for the code you used, take a look at perlcritic. If it doesn't yet have a rule for it, you could create one.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.