mce has asked for the wisdom of the Perl Monks concerning the following question:
I was reviewing some code from a coworker (no, not my code :-) ), and I found a severe perl error, but the code works fine.
Now, I was wondering, why does it actually work. This is his code reformatted
$a{test}="very "; $a{test}{this}="strange"; print $a{test}; print $a{test}{this};
So "very" is the bareword that is a reference to a hash, but why does it work???$a{test}="very "; $a{test}->{this}="strange"; print $a{test}; print very->{this}; #### ?????
But I am afrait that this does not clear up memory (is this correct?)delete $a{test}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: bareword and hash reference
by fruiture (Curate) on Aug 22, 2002 at 14:12 UTC | |
by mce (Curate) on Aug 22, 2002 at 14:24 UTC | |
by fruiture (Curate) on Aug 22, 2002 at 14:30 UTC | |
by djantzen (Priest) on Aug 22, 2002 at 14:50 UTC |