Thanks Alan . I had got this piece of info from google but I do not understand clearly what it wants to define . It would be good , if you can explain bit more .
Regards Sunita -----Original Message----- From: Alan Haggai Alavi [mailto:alanhag...@alanhaggai.org] Sent: Saturday, March 26, 2011 1:19 PM To: Sunita Rani Pradhan Cc: beginners@perl.org Subject: Re: assigning hash to a scalar Hi Sunita, > $var = %input; > ... > Output : 3/8 --> What does this output mean ? You are evaluating a hash in a scalar context. Quoting 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. For example, you stick 10,000 things in a hash, but evaluating %HASH in scalar context reveals "1/16", which means only one out of sixteen buckets has been touched, and presumably contains all 10,000 of your items. This isn't supposed to happen. If a tied hash is evaluated in scalar context, a fatal error will result, since this bucket usage information is currently not available for tied hashes. Regards, Alan Haggai Alavi. -- The difference makes the difference -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/