Re: accessing hash values with %hash->{foo} ?




Paul Lalli wrote:
I ran across this bizarreness while cleaning up someone else's old
code. A short-but-complete script to demonstrate:

Excellent!

%hash->{alpha} = 'one';

Why does this work?

It's a bug in the compiler, but becase it does no real harm and there's
bad code out there exlpoiting it, it's not been fixed. (Actually in
earlier versions of Perl it did do harm IIRC, it corrupted the ref
count).

... seems to suggest that the interpeter is allowing %hash->{foo} to
be syntactic sugar for $hash{foo}.

"Sugar" would not be the word I'd use. Bitrex perhaps?

.