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.
|
|---|