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


in reply to Finding the size of an array in a hash?

Hofmater set you straight, but i feel inclined to offer two more tips:
  1. push @{$FULLLINES{$account}}, “$lines”;
    Don't put quotes around $lines -- this is habit that will get you into trouble when you start dealing with references. Besides, the quotes are completely superficial since they will allow the contents to evaluate to the ... contents, namely, the variable $lines. Use this instead:
    push @{$FULLLINES{$account}}, $lines;
  2. Learn how to format. Get a copy of PerlTidy if you have to. Having to count braces to determine where scope starts and ends is no fun for an experienced programmer. If you want to play with the big dogs, dress the part!
Here is your above code, reformatted for clarity and corrected (you left out the closing brace for the very first foreach).
foreach $key ( sort keys %FULLLINES ) { $CCOUNT = 0; print "key = $key\n"; next if $key eq "N/A"; $CCOUNT++ for @{$FULLLINES{$key}}; $num = $CCOUNT; if ( $num <= 1 ) { print "account number for $key listed $num times\n"; } else { print "Account $key is listed:$num times\n"; } }
Oh yeah .... one more tip: USE STRICT! ;)

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)