use strict; my %a = (); ## This is the change. print "test_1" if ( %a ); print "test_2" if ( defined( %a ) );