in reply to Add Data to Hash Reference

As moritz said, you told it to create a string, not a hash. You can explicitly tell your code to create an empty hash like this:

my $test = { record => {} };

or you could use undef, leaving the slot empty for perl to put in a hash reference when you execute line 8.

...roboticus

When your only tool is a hammer, all problems look like your thumb.