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
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.push @{$FULLLINES{$account}}, “$lines”;
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";}
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Finding the size of an array in a hash?
by Hofmator (Curate) on Feb 10, 2003 at 13:06 UTC | |
by spacey (Scribe) on Feb 10, 2003 at 13:12 UTC | |
(jeffa) Re: Finding the size of an array in a hash?
by jeffa (Bishop) on Feb 10, 2003 at 15:36 UTC | |
Re: Finding the size of an array in a hash?
by FoxtrotUniform (Prior) on Feb 10, 2003 at 15:53 UTC | |
by waswas-fng (Curate) on Feb 12, 2003 at 05:09 UTC | |
by FoxtrotUniform (Prior) on Feb 12, 2003 at 08:26 UTC | |
Er...
by Nkuvu (Priest) on Feb 10, 2003 at 21:47 UTC | |
by Nkuvu (Priest) on Feb 11, 2003 at 17:04 UTC |
Back to
Seekers of Perl Wisdom