Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^3: counting elements using a hash

by Marshall (Abbot)
on Sep 23, 2012 at 12:28 UTC ( #995204=note: print w/replies, xml ) Need Help??


in reply to Re^2: counting elements using a hash
in thread counting elements using a hash

That is a good point. These zero's or undef's are problematic.

The problem statement had 1..100 so this zero didn't enter into the situation. In this case, $number==0 should be skipped (same as undef). So what about $number >100? Well, the OP should should show some revised code and we will iterate again to get it fine tuned. A major point was that Perl will create a new key (auto-vivify) when needed - there is no need to test whether or not the key exists. Second point was a numeric instead of alpha sort.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://995204]
help
Chatterbox?
[Corion]: Weird - this "Install our backdoor SDK" spam is persistent. And I get the feeling it's not even automated, as it seems to be a re-forward of each mail, maybe even manually. Ah well, a quick rule in Thunderbird will move them to Spam automatically now :D

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2018-05-25 13:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?