in reply to Re: what does main->{x} = 1 do?
in thread what does main->{x} = 1 do?
This seems to be ok as long as the method is called on an object. But say you call the method on a class(say by mistake), then it was causing problems without the arrow operator. But when the arrow operator was included it was working fine although the method was meant to be an object method. So then I saw I needed to brush up some fundametals! So if I understand it correctly what happens here is that the hash variable is actually defined in the package where the code belongs. And it happens because strict refs is off. Thanks in advance for the help. Thanks again!sub { if ( @_ == 1 ) { $_[0]->{$name} # this was initially $_[0]{$name} } else { $_[0]->{$name} == $_[1]; # initially $_[0]{$name} = $_[1]; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: what does main->{x} = 1 do?
by ikegami (Patriarch) on May 15, 2008 at 05:02 UTC | |
|
Re^3: what does main->{x} = 1 do?
by blazar (Canon) on May 14, 2008 at 22:20 UTC | |
|
Re^3: what does main->{x} = 1 do?
by Jenda (Abbot) on May 14, 2008 at 23:42 UTC |