in reply to Re: Closures and undefined subs
in thread Closures and undefined subs
As soon as your out subroutine's scope is exited both of in and in2 are restored to their previous contents.
That's not a problem since he doesn't create any external references to in_2. He'd need lexicals in that case. For example, he'd need to use lexicals if the outer sub returned \&in_2.
Using lexicals doesn't help here. In addition to the more complex call syntax, using lexicals would create a memory leak if recursion was involved unless you explicitly undefed the lexical at the end of the outer sub.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Closures and undefined subs
by Anonymous Monk on Sep 26, 2007 at 14:39 UTC | |
by ikegami (Patriarch) on Sep 26, 2007 at 14:46 UTC | |
|
Re^3: Closures and undefined subs
by ursus (Acolyte) on Sep 28, 2007 at 22:41 UTC |