in reply to Re: Grouping Objects by Attribute
in thread Grouping Objects by Attribute

Thanks, edan, that did the trick.

However, I don't quite get the bit

@{ $monks_by_level{$level} }

I understand this to mean that the $monks_by_level{$level} is the value of the hash for the key $level and that the @{ ... } around it automagically makes this value an array. Is this right?

loris

Replies are listed 'Best First'.
Re^3: Grouping Objects by Attribute
by edan (Curate) on Nov 01, 2004 at 10:14 UTC

    You're right, you just need a bit of terminology thrown in there. $monks_by_level{$level} is an array reference (see perlref for details) and @{ } is how we dereference an array reference, so that we can use it as an array. You could also dereference individual scalars in the array using syntax such as $monks_by_level{$level}[0].

    --
    edan