in reply to Re^2: Ghostly subroutine variables haunting me in subsequent calls
in thread Ghostly subroutine variables haunting me in subsequent calls

True, but if the OP is deliberately creating a closure, then he probably wouldn't be asking the question.

Even then, use strict (or maybe -w, I use both so I'm never quite sure which is giving me the information), would still be a good idea as it might well warn him of an even deeper and more obscure problem in the event that the closure is not knowingly deliberate:

sub outer{ my @a; sub inner{ push @a, 1; return \@a; } return 1 };; Variable "@a" will not stay shared at (eval 3) line 1, <STDIN> line 1.

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
  • Comment on Re^3: Ghostly subroutine variables haunting me in subsequent calls
  • Download Code