in reply to How to test for empty hash?

You're on the right track, but the way to test for the array (of keys) being empty is:

if ( @a == 0 )

You can skip the intermediary variable:

if ( keys(%hash) == 0 )