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.
In reply to Re^2: Closures and undefined subs
by ikegami
in thread Closures and undefined subs
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |