Perl 5 version 16.3 documentation
lastcommand is like the
breakstatement in C (as used in loops); it immediately exits the loop in question. If the LABEL is omitted, the command refers to the innermost enclosing loop. The
continueblock, if any, is not executed:
Note that a block by itself is semantically identical to a loop that executes once. Thus
lastcan be used to effect an early exit out of such a block.