It also came a little.
my %h = ();
Note the use of () instead of {} .
Explanation: The value {} is a hash reference, not a hash itself. In Perl, a link is a kind of scalar value, and assigning %h has special handling to assign a single scalar value. It builds a scalar (gives you the HASH(0x229e8) string HASH(0x229e8) in your case) and associates this key with the undef value.
When using () assigning from a list to a hash creates key / value pairs from the pairs in the list, and since () empty, the %h hash becomes empty.
Greg hewgill
source share