I'm sure this makes sense somehow, just not to me as I am
inexperienced.
When I print my hash via:
print %myhash;
it prints out something like 2/8 or 4/8.
Nope. That cannot happen. Printing the %hash in list context results in
the key-value pairs being printed.
Always a fraction like that. Is there a general cause of this?
You get the m/n notation when you evaluate a hash in scalar context.
That means m buckets out of the n are used. This is all documented in
perldoc perldata:
If you evaluate a hash in scalar context, it returns false if the hash
is empty. If there are any key/value pairs, it returns true; more
precisely, the value returned is a string consisting of the number of
used buckets and the number of allocated buckets, separated by a slash.
This is pretty much useful only to find out whether Perl's internal
hashing algorithm is performing poorly on your data set.
You should, at the very least, read perldata, perlsyn, perlop, perlfunc
and, of course, perlfaq if you plan to learn Perl.
Sinan
--
A. Sinan Unur <
[email protected]>
(remove .invalid and reverse each component for email address)
comp.lang.perl.misc guidelines on the WWW:
http://www.rehabitation.com/clpmisc/