http://qs1969.pair.com?node_id=558355


in reply to "eval" and "my" variable weirdness

I don't think it's a bug, but I might be wrong. The problem is that there's no reason for Perl to keep $thingy (a lexical) around once it's done compiling Bob.pm because nothing that "lasts" refers to it. However, if you have my $x = $thingy in a function in Bob.pm, that basically produces a closure around $thingy and keeps $thingy in existence.

Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart