This is a loop exit:

sub f { last; } say "before loop"; { say "start of loop"; f(); say "end of loop"; } say "after loop";

({ ... } is technically a loop. You can also use while/until loop, a foreach loop, or a C-style for loop.)

This outputs

before loop start of loop Exiting subroutine via last at -e line 1. after loop
So the documentation you quoted refers to programs such as the following:
$SIG{ __DIE__ } = sub { last; }; say "before loop"; { say "start of loop"; die "!"; say "end of loop"; } say "after loop";

However, the code doesn't do what the documentation claims it does.

before loop start of loop Can't "last" outside a loop block at -e line 1.

choroba pointed out that the documentation was corrected a short while ago.

However, the documentation is wrong, and it was corrected a short while ago. (Thanks to choroba for identifying this.)


In reply to Re: exit from $SIG{__DIE__} via a loop exit? by ikegami
in thread exit from $SIG{__DIE__} via a loop exit? by ForgotPasswordAgain

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.