in reply to Re^2: Dumping undef as a constant produces strange REFCNT
in thread Dumping undef as a constant produces strange REFCNT
I'm also curious whether this is some real count value or some artifact of Devel::Peek
It's the real value of the REFCNT field, but it does not indicate the number of references to that scalar.
My guess would be that 2147483647, max val for signed long, is the starting point.
Yes, or more precisely, the midpoint of 32-bit unsigned ints (even on a 64-bit build).
The max value wouldn't be good because it's possible to increase it.
$ perl -E' sub show { say &Internals::SvREFCNT( \undef ); } show(); push @a, \undef for 1..5; show(); ' 2147483623 2147483628
Of course, it's also possible to reduce it.
$ perl -E' sub show { say &Internals::SvREFCNT( \undef ); } show(); { my @a; $#a = 5; } show(); ' 2147483623 2147483617
|
|---|