in reply to Re: How to test for empty hash?
in thread How to test for empty hash?
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: How to test for empty hash?
by Anonymous Monk on Aug 06, 2021 at 11:01 UTC |