Also bear in mind that the way in which Perl is actually doing this, explicitly or implicitly, is through the magic of references. The value associated with a particular hash-key, like a particular element in an array, is always “a single scalar,” but ... a reference is “a single scalar,” no matter what it refers to. That is the secret to creating arbitrary data-structures in Perl. The memory-manager allows an arbitrary number of references to exist to the same piece of data and maintains a reference-count for each piece, automatically disposing of no-longer-referenced pieces.
So, Perl’s technically-correct view of your title line would be: “inserting a reference to an array, into one of the hashes which are referenced by: an array, whose elements happen to entirely consist of: references to hashes.”
Self-evident: hashref is slang for “reference to a hash;” arrayref is slang for “reference to an array.”
Perl is a very forgiving language that encourages “say what I mean,” allowing you to say the same thing in several different ways ... but it is important to bear in mind that this is how all those ways of saying it wind up. References are one of the “cornerstone ideas” of this language.
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:
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||