http://www.perlmonks.org?node_id=999813


in reply to Inserting an array in an array of hashes

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.