Perl: the Markov chain saw | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
goto says (among other things) Use of "goto-LABEL" or "goto-EXPR" to jump into a construct is deprecated and will issue a warning. Even then, it may not be used to go into any construct that requires initialization, such as a subroutine or a "foreach" loop. It also can't be used to go into a construct that is optimized away. So LABELs are like lexicals, except with only file-scope or subroutine-scope ( Lexical scoping like a fox ) lexical(my) variables from one loop/block is not visible in another, but labels are , because they currently have file scope (like my $foo at the top of a file outside of any bare blocks) currently { L: say 1; } is like my $L; { $L=1; say $L; } But this will change, once Use of "goto" to jump into a construct is deprecated is disallowed, labels will be lexically scoped like my $vars someday { L: say 1; } is like { my $L=1; say $L; } In reply to Re: How does 'goto LABEL' search for its label?
by Anonymous Monk
|
|