Actually you got 1 less than the number of keys because arrays are zero based, but that's a different problem. If you read the keys documentation the second sentence explains that calling it in scalar context returns the number of keys: my $num_keys = keys %data.
The cake is a lie.
The cake is a lie.
The cake is a lie.
In reply to Re: find a number of keys in a hash
by Fletch
in thread find a number of keys in a hash
by perlthirst
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |