Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: How to safely use $_ in a library function?

by ikegami (Pope)
on Sep 18, 2013 at 19:08 UTC ( #1054725=note: print w/replies, xml ) Need Help??


in reply to How to safely use $_ in a library function?

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1054725]
help
Chatterbox?
[james28909]: hi, im james, and i am bat shit crazy. xD
[james28909]: crazy or genius....
[Eily]: hi bat shit crazy, I'm eily
[LanX]: hello James
[james28909]: lol
[james28909]: i honestly didnt thin kanyone was going to respond, or was even paying attention :l

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (9)
As of 2017-12-13 17:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (373 votes). Check out past polls.

    Notices?