You've been bit by the dread "indirect object" syntax. Basically bareword $object is another way to write $object->bareword (I think the original impetus was to allow things like my $instance = new Classname foo => "bar"; to be written). It's similar to being able to use print BLOCK LIST where the block's value is the filehandle to use. In your case it works that hash{$key} behaves like $key->hash and then $key had a value of "c" (and you then didn't have a package named "c" with a "hash" method and things blew up).
The cake is a lie.
The cake is a lie.
The cake is a lie.
In reply to Re: Why does this code pass a syntax check?
by Fletch
in thread Why does this code pass a syntax check?
by dwm042
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |