xdg, you're right, but then the question is why one would use a variable that is potentially undefined??
for this, testing whether the hash has values is better like in muntfish's solution.
using a hash in scalar context gives 0 for a empty hash and the number of used entries for a nonempty hash.