in reply to How to check whether a hash is empty (has no keys)?

Just use the name of the hash in scalar context, such as

if (%foo) { # %foo has at least one key } else { # %foo has no keys }

If you want to be very explicit, you can also write

if (!!%foo) { ... }
or
if (scalar %foo) { ... }
or
if (0+%foo) { ... }