[Israel.pm] reference to tied variables

Yuval Yaari yuval at windax.com
Thu Jul 15 13:28:16 PDT 2004


Sorry - what I wanted to say about references and forgot:
$$Bar = 4;
is equivalent to
$Foo = 4;
(In case, like in your example, that $Bar is a reference to $Foo)

So it's not a bug, it's a feature :)

  --Yuval

Moshe Kaminsky said:
> Hi,
>
> Please consider the following code segment:
>
> ====8<===={
>     tie my $Foo, Momo;
>     $Bar = \$Foo;
> }
> $$Bar = 4;
> print $$Bar, "\n";
> ====>8===Surprisingly, this actually works (ie, whatever magic Momo
> introduces  applies in the assignment and printing). My question is
> first whether it  is intentional, and if so, how do I untie whatever is
> tied now, and when  the controlling object gets destroyed.
>
> The reason I ask is that I managed to apply this nicely by combining it
> with overloading, and all works fine until I get to the destruction of
> the controlling object, where I see very weird things that I can only
> describe as a bug.
>
> Thanks,
> Moshe
>
> --
> I love deadlines. I like the whooshing sound they make as they fly by.
>                                         -- Douglas Adams
>
>     Moshe Kaminsky <kaminsky at math.huji.ac.il>
>     Home: 08-9456841






More information about the Perl mailing list