[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Omaha.pm] Fwd: ref to a ref? circular refs?



-laugh-

Here's me back in January having fun with references to references...

I stumbled into this entirely by mistake. Has anyone on the list ever *intentionally* made a reference to a reference?

j


Begin forwarded message:
From: Jay <jhannah@ferret.jays.net>
Date: January 19, 2007 3:15:01 PM CST
To: jay@jays.net
Subject: ref to a ref? circular refs?


my $a = 10;
my $b = \$a;
my $c = \$b;
my $d = \$c;
my $e = \$d;

exit;



main::(j.pl:2): my $a = 10;
auto(-1)  DB<1> o pager=less
               pager = '|less'
DB<2> n
main::(j.pl:3): my $b = \$a;
DB<2> n
main::(j.pl:4): my $c = \$b;
DB<2> n
main::(j.pl:5): my $d = \$c;
DB<2> n
main::(j.pl:6): my $e = \$d;
DB<2> n
main::(j.pl:8): exit;
DB<2> x $e
0  REF(0x830439c)
   -> REF(0x812e2b0)
         -> REF(0x812e244)
               -> SCALAR(0x812e1f0)
                     -> 10

  DB<3> q




$ cat j.pl

my $a = 10;
my $b = \$a;
$a = $b;

exit;


main::(j.pl:2): my $a = 10;
auto(-1)  DB<1> o pager=less
               pager = '|less'
DB<2> n
main::(j.pl:3): my $b = \$a;
DB<2> n
main::(j.pl:4): $a = $b;
DB<2> n
main::(j.pl:6): exit;
DB<2> x $a
0  REF(0x812e1f0)
   -> REF(0x812e1f0)
         -> REUSED_ADDRESS
DB<3> x $b
0  REF(0x812e1f0)
   -> REF(0x812e1f0)
         -> REUSED_ADDRESS


/