in reply to Re^3: Changing a returned hashref
in thread Changing a returned hashref

Thanks!

What I found a bit confusing was how perl see the above hashref as a reference to another hashref instead of a reference to a hash with 2 keys...

Replies are listed 'Best First'.
Re^5: Changing a returned hashref
by aaron_baugher (Curate) on Nov 09, 2011 at 14:25 UTC

    Yes, that can be confusing until you get used to it. The thing to keep in mind is that the values of a hash (or an array) can only be scalars. A scalar is always a single "thing": a number, a string, or a reference -- never a complex structure made of multiple things. So when we talk about something like, "a hash of hashes of arrays," that's really shorthand for, "a hash of references to hashes containing references to arrays."

    Aaron B.
    My Woefully Neglected Blog, where I occasionally mention Perl.