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


in reply to length or array in a hash

Hi, ongaku,
You can do like so:

%hash = ( 'one' => [1], 'two' => [2,2], 'three' => [3,3,3], ); foreach my $array (keys %hash){ print $array," :", scalar @{$hash{$array}},$/; }
Output
three :3 one :1 two :2
You might want to check the function scalar

If you tell me, I'll forget.
If you show me, I'll remember.
if you involve me, I'll understand.
--- Author unknown to me