Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Size of a HASH (with more keys)

by choroba (Chancellor)
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 }
لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Replies are listed 'Best First'.
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?
[Lady_Aleena]: atcroft, at least you have some code people are interested in. No one even linkes my code.
[atcroft]: Lady_Aleena: I can as well... I just hate when my mind and fingers disagree (which has happened more than a few times recently).
[Lady_Aleena]: Well, not much of my code. A few little things people here like. The big things though, the more important to me code, people here seem to loathe.
[atcroft]: Lady_Aleena: My early code was pretty horrible... but somewhere early on I learned not to take criticism of my code personally... which was probably a good thing, considering the kind of code I wrote at the time. :\
[Lady_Aleena]: I am hungry, so I'm going to go make something to eat. I hope you figure it out atcroft. Have a nice night!
[atcroft]: I have one script that I have started re-writing several times over the years, and have yet to get it working in a cleaner/better form. (It is some smelly code-I did not even know about hashes at the time I wrote it.)
[atcroft]: Enjoy, Lady_Aleena!

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2017-05-27 05:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?