|
|
| Don't ask to ask, just ask | |
| PerlMonks |
Re: No: of values in a hashtableby kcott (Parson) |
| on Sep 18, 2012 at 06:15 UTC ( #994188=note: print w/ replies, xml ) | Need Help?? |
|
Accordingly, scalar @{ $weekly_hash{$i} } will return the number of values:
Your code shows no undefined values. Your text has "... the number of values ...". An undefined value is still a value:
If you really meant that you only wanted a count of defined values, you can do this:
The count of elements in an array is always available via scalar; there's no need to introduce temporary count variables. -- Ken
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||