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

spacey has asked for the wisdom of the Perl Monks concerning the following question:

Hi all, I am past the point of braking and in so I turn to the people that will know.

I have looked over the Q/A but unless I missed it I didn’t see an answer?

My problem:
I currently have a hash of arrays. I can find the number of keys in the hash but I wish to find the number of element in each array?

I have constructed the hash using

push @{$FULLLINES{$account}}, “$lines”;
I have managed to count lines using the below solution but I am sure its not ideal. Is there a proper way of doing this? I have tried all different types of array length test and hash length test but I can’t find the one for me.
foreach $key (sort keys %FULLLINES){ $CCOUNT = 0; print "key = $key\n"; if ($key eq "N/A") {next;} foreach $fullline (@{$FULLLINES{$key}}) { $CCOUNT++ } $num = $CCOUNT; if ($num <= 1) { print "account number for $key listed $num times\n"; } else {print "Account $key is listed:$num times\n";}