in reply to Re^3: A curious case of of my()
in thread A curious case of of my()
If the array were lexically declared it would not persist between calls to the subroutine.
Really?
use Devel::Peek qw( Dump ); sub f { my $x; Dump($x); $x = "abc"; } f(); f();
SV = NULL(0x0) at 0x2cb90dc REFCNT = 1 FLAGS = (PADMY) SV = PV(0x1542f64) at 0x2cb90dc REFCNT = 1 FLAGS = (PADMY) PV = 0x154b194 "abc"\0 CUR = 3 LEN = 12
You can tell it's the same variable in both calls to the function not only by the address being the same, but by the state left over between calls. Would you care to change you claim that this $x isn't a lexical?
See Re: A curious case of of my()
|
|---|