snax has asked for the wisdom of the Perl Monks concerning the following question:
constructs worked. I suggested it was a context issue, since the -> implies a reference. This is a little different than other "context" concepts I'm used to in Perl, so maybe I'm off base.%h->{key} = 'value'; @a->[0] = 12;
Further, in Programming Perl, 2nd Ed., it says (page 79):
Just as in C and C++, -> is an infix dereference operator. If the right side is either a [...] or {...} subscript, then the left side must be either a reference to an array or hash (or a location capable of holding a hard reference, if it's an lvalue (assignable)).
So this would suggest that in this context %h and @a above are references -- or treated as references.
Anyone know if there is a deep reason for this?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: What's with the -> operator?
by Dominus (Parson) on Nov 30, 2000 at 19:36 UTC | |
by snax (Hermit) on Nov 30, 2000 at 20:27 UTC | |
by Dominus (Parson) on Nov 30, 2000 at 20:48 UTC | |
|
Re: What's with the tt-/tt operator?
by Fastolfe (Vicar) on Nov 30, 2000 at 19:29 UTC |