Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^2: a sub within a sub -- revisiting

by ikegami (Pope)
on Apr 11, 2010 at 06:21 UTC ( #834057=note: print w/ replies, xml ) Need Help??


in reply to Re: a sub within a sub -- revisiting
in thread a sub within a sub -- revisiting

Note that the above leaks if the anon sub accesses $bar. That would be the case if the anon sub is recursive, for example. I find the following simpler, and it doesn't leak.

sub foo { ... local *bar = sub { ... }; bar(...); }


Comment on Re^2: a sub within a sub -- revisiting
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://834057]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (14)
As of 2015-07-07 22:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (93 votes), past polls