in reply to num keys of the hash within hash?
Using a hash in scalar context returns "x/y", where x is the number of values and y is the number of allocated buckets (see Scalar values). If you have warnings on, using that in numeric context will warn you that something that wasn't a number was used as one. Of course, since the leading number is exactly what you want, the numification is actually successful even though the interpreter spits a warning. You can fix this by using keys or values in scalar context instead or suppressing the warning locally.
The other possibility is that you are passing a reference when you intend to be passing a hash (a hash or hashes is really a hash of hash references). See perlref and/or perlreftut for information on dereferencing.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: num keys of the hash within hash?
by AnomalousMonk (Archbishop) on May 26, 2009 at 17:40 UTC |