in reply to How do I find out if a hash is empty?
Hum... I have tried all of those approaches and none of them work.
For example, the following script:
---- Start script--- End scriptuse strict; my %hash = {}; print "\%hash=".%hash."\n"; print "scalar(\%hash)=".scalar(%hash)."\n"; print "length(\%hash)=".length(%hash)."\n"; %hash = undef; print "defined(\%hash)=".defined(%hash)."\n";
Results in the following output:
%hash=1/8 scalar(%hash)=1/8 length(%hash)=3 defined(%hash)=1
Does any of you know what the problem is? I am using perl v5.8.3.
Originally posted as a Categorized Answer.
|
|---|