http://www.perlmonks.org?node_id=173685

Q&A > hashes > How do I find out if a hash is empty? - Answer contributed by particle

a hash in scalar context returns (somewhat uselessly -- except for now,) the number of slots filled out of the number of slots allocated. so scalar %hash will equal 0 if no slots are allocated.

print 'empty' unles scalar %hash;