in reply to Re: lexicals are all the same scalar and never go out of scope?
in thread lexicals are all the same scalar and never go out of scope?
By your logic, the following never deallocates the referenced array:
use Devel::Peek; $x = []; Dump($x, 1); $x = undef; $x = []; Dump($x, 1);
SV = IV(0x51a420) at 0x51a424 REFCNT = 1 FLAGS = (ROK) RV = 0x61b29c SV = PVAV(0x61c248) at 0x61b29c REFCNT = 1 FLAGS = () ARRAY = 0x0 FILL = -1 MAX = -1 ARYLEN = 0x0 FLAGS = (REAL) SV = IV(0x51a420) at 0x51a424 REFCNT = 1 FLAGS = (ROK) RV = 0x61b29c SV = PVAV(0x61c248) at 0x61b29c REFCNT = 1 FLAGS = () ARRAY = 0x0 FILL = -1 MAX = -1 ARYLEN = 0x0 FLAGS = (REAL)
But that's just not true. It just got reallocated at the same address. Looking at the address is not meaningful.
(I'm not saying that it isn't the same scalar. I'm saying you haven't shown that it is the same scalar.)
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: lexicals are all the same scalar and never go out of scope?
by Eliya (Vicar) on Dec 06, 2011 at 10:32 UTC | |
by ikegami (Patriarch) on Dec 06, 2011 at 10:44 UTC |
In Section
Seekers of Perl Wisdom