in reply to Re: how do $x = \12 differ from $$y = 12 ?
in thread how do $x = \12 differ from $$y = 12 ?

Thanks, that takes me closer to the answer. I wonder why $y is undefined now.
use Scalar::Util qw/weaken/; my ( $x, $y ); $x = \12; $$y = 12; weaken($x); weaken($y); print $x; print $y; __OUTPUT__ SCALAR(0x1807f24) Use of uninitialized value in print at 5432.pl line 11.
Boris

Replies are listed 'Best First'.
Re^3: how do $x = \12 differ from $$y = 12 ?
by japhy (Canon) on May 10, 2005 at 13:15 UTC
    Someone else showed you Devel::Peek code that explains that. $x has a refcount of 2, and $y only has a refcount of 1. It's the same as doing:
    $x = \@array; $y = [];
    There, $x has a refcount of 2 (from $x and @array), whereas $y has a refcount of only 1.

    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