Your skill will accomplish what the force of many cannot |
|
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Preferably with if (!keys %hash) { print "Empty" }.
This has the drawback of actually going through fetching all the keys for a tied hash, but the alternative (if (!%hash) { print "Empty" }) doesn't work at all for tied hashes. If tied hashes aren't a concern, either way will do, but there is a difference to be aware of: the keys version will reset the hash's iterator (see each) while the other way will leave it unchanged. In reply to Re: How do I find out if a hash is empty?
by ysth
|
|