Gowtham wrote:
Interestingly, A hash in a scalar context returns some fraction.

Like, this code

@array = ( 1 .. 100 );
%hash = @array;
print scalar %hash, "\n";

prints

33/64

Can somebody help me understand what this 33/64 is?

Thanks
Gowtham



It means that the hash has used 33 buckets of the 64 it allocated. Since there are 50 key/value pairs in the hash, you have some collisions.

A more useful measure of a hash's size is:

  print scalar keys %hash, "\n";


--- Shawn

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to