Thank you for your comment, AnomalousMonk. I thought that something like:
print scalar values %hash;
would return a count on only the defined values. After a quick try, this is obviously not the case. My error.
This leads me to another possible solution illustrated in the following session under the Perl debugger:
DB<1> %hash = (jan => 1, feb => 2, mar => undef, apr => undef, may =
+> 5);
DB<2> x %hash
0 'feb'
1 2
2 'jan'
3 1
4 'may'
5 5
6 'mar'
7 undef
8 'apr'
9 undef
DB<3> print scalar grep {defined $_} values %hash;
3
DB<4> print scalar grep {defined $_} keys %hash;
5
|