Buried in another
thread the issue
was raised about why
%h->{key} = 'value';
@a->[0] = 12;
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.
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?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.