in reply to Re^2: print array of hashes
in thread print array of hashes

@rec is an array of hashrefs, therefore $ref[0] is a hashref. The arrow is optional here, we have two possible ways to get the value of the kids key. The value is an arrayref, so we dereference it with @{} to get the array. And scalar applied to a list an array returns the number of elements in it.

Update: rephrased because of almut's reply.

Replies are listed 'Best First'.
Re^4: print array of hashes
by almut (Canon) on Apr 22, 2010 at 16:05 UTC
    And scalar applied to a list returns the number of elements in the list.

    That statement could be misleading...:

    $num = scalar ( qw(foo bar) ); print $num; # "bar", not 2!

    A list (as opposed to an array) in scalar context evaluates to its last element.

Re^4: print array of hashes
by Anonymous Monk on Apr 22, 2010 at 17:02 UTC
    this site amazes me...the helpfulness of the participants is something else...thanks, all.