The difference between
sub { ...; goto &foo; }
and
sub { ...; &foo; }
is that the stack is unwound before the call in the former and after the call in the latter. In other words, you are asking how to protect a variable in a lexical scope you explicitly exit before you need it.
You can't have it both ways. Either you create a scope where $_ is protected or you destroy it, but you can't do both.
In reply to Re: How to safely use $_ in a library function?
by ikegami
in thread How to safely use $_ in a library function?
by perl-diddler
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |