in reply to last/next/redo usages
Provided the target label is set it's possible to goto out of a sub into a scope in the dynamic caller chain. (One use case is to short circuit leaving a recursion, without needing to step thru hundreds of returns*)
So this behavior doesn't surprise me. (Though I would have expected to see a label)
My bet is the documentation is wrong or badly worded or at least outdated.
Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Wikisyntax for the Monastery
*) demo
use strict; use warnings; use 5.12.0; sub count_down { my ($a)=@_; say --$a; goto EXIT unless $a; count_down($a) } count_down(10); say "never reached"; EXIT: say "byebye";
9 8 7 6 5 4 3 2 1 0 byebye
|
|---|