in reply to Constructing a hash
Your program doesn't run as shown, so you have either retyped it incorrectly or are mistaken in thinking you have run it. It is always best to cut and paste the exact program you are trying to debug.
Once the missing shebang line, missing closing double quote in the die, missing use statement for Data::Dumper, and missing declaration of variables are all fixed, the program in fact works.
In Section
Seekers of Perl Wisdom