Here's a guess :)
The -> notation implies a context -- in fact,
it implies that whatever to the left is a reference,
and whatever is to its right is "owned" by the
referred-to object.
Perl seems pretty smart about context.
So, in these cases, it interprets the thing to the left as
a reference to the object named, and voila, does the right
thing, since the "members" are being referred to properly.
If you try to use ref() on the whole "thing"
(hash or array) you won't see it as a reference because
it is simply interpreting the "thing" in a scalar context,
though.
Update:
Looking in perlref there is the cryptic comment:
.
References of the appropriate type can spring into existence if you dereference them in a context that assumes they exist. Because we haven't talked about dereferencing yet, we can't show you any examples yet.
(See number 6).
I'm guessing that's the case here.
|