This is a bit confusingly written.
The question was about checking if a hash is empty, and %h in scalar context can be used to do this portably (though the relative recent change makes it more efficient).
That said,
%h in scalar context can't be used to get the number of keys portably.
keys(%h) in scalar context can be used to get the number of keys portably and efficiently.
That's not true. You could aways use There was a relatively recent change thatefficiency of hash in boolean context
Seeking work! You can reach me at ikegami@adaelis.com
In reply to Re^2: How to test for empty hash?
by ikegami
in thread How to test for empty hash?
by scareduck
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |