Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Size of a HASH (with more keys)

by choroba (Abbot)
on Jul 02, 2014 at 12:02 UTC ( #1091973=note: print w/ replies, xml ) Need Help??


in reply to Size of a HASH (with more keys)

Use keys in scalar context:

my $count = keys %{ $testHash{$year} }

It might be better not to output the comma, though. Just invert the logic and print it before each sequence except the first one which is easy to detect:

my $first = 1; while (...) { print ',' unless $first; undef $first; print "..."; # print the sentence }
لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ


Comment on Re: Size of a HASH (with more keys)
Select or Download Code
Re^2: Size of a HASH (with more keys)
by David92 (Sexton) on Jul 02, 2014 at 12:30 UTC
    I tried using your suggestion, but it didnt work. I am onto debugging, if something's wrong before with the Hash.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1091973]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (8)
As of 2014-12-26 02:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (164 votes), past polls