That is a good point. These zero's or undef's are problematic.
in reply to Re^2: counting elements using a hash
in thread counting elements using a hash
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.