On Thursday 06 September 2001 05:52 pm, Ken Fox wrote:
> I think we have a language question... What should the following
> print?
>
>   my $x = 1;
>   my $y = \$x;
>   my $z = 2;
>   %MY::{'$x'} = \$z;
>   $z = 3;
>   print "$x, $$y, $z\n"
>
> a. "2, 1, 3"
> b. "2, 2, 3"
> c. "3, 1, 3"
> d. "3, 3, 3"
> e. exception: not enough Gnomes
>
> I think I would expect behavior (c), but it's not obvious to me.

SCALAR(addr),SCALAR(addr), 3

$$x,$$$y,$z = "3,3,3"

My $x container contains 1.  ($x = 1)
My $y container contains a ref to the $x container.  ($x = 1, $y = \$x)
My $z container contain 2.  ($x = 1, $y = \$x, $z = 2)
My $x container now contains a ref to the $z container. 
   ($x = \$z, $y = \$x, $z = 2)
My $z container now contains 3.  
   ($x = \$z, $y = \$x, $z = 3, or $$x = 3, $$y = \$z, $z = 3, or 
   $$x = 3, $$$y = 3, $z = 3)


-- 
Bryan C. Warnock
[EMAIL PROTECTED]

Reply via email to