Hmmmm.... I see your point. @{$x->{y}} _is_ probably a better way to clarify this to the parser(and to the poor soul who has to maintain the code somewhere down the line- probably me.)
Looking at perlop, I'm a little confused as to _why_ it works myself.
Quoting from the Docs: (with my comments not in <code> tags)
The Arrow Operator
``->'' is an infix dereference operator, just as it is in C
and C++. If the right side is either a [...], {...}, or a
(...) subscript,
..It seems this describes the situation..
then the left side must be either a hard or symbolic
reference to an array, a hash, or a subroutine respectively.
(Or technically speaking, alocation capable of holding a
hard reference, if it's an array or hash reference being
used for assignment.)
See the perlreftut manpage and the perlref manpage.
Otherwise, the right side is a method name or a simple
scalar variable containing either the method name or a
subroutine reference, and the left side must be either an
object (a blessed reference) or a class name (that is, a
package name). See the perlobj manpage.
It seems somehow the -> is binding before the @ in @$x, contrary to what I see in perlop
I guess I should consider it a _feature_.
Thank you, chip for noticing something that I completely glossed over. Good brain food.
-ase
|