in reply to Add Data to Hash Reference

$test->{record} is a string - you make it one, explicitly. Which is why you can't use it as a hash ref.

Replies are listed 'Best First'.
Re^2: Add Data to Hash Reference
by Anonymous Monk on Dec 07, 2010 at 20:25 UTC
    So, if I want to construct the data structure in my example, how should I write it?

      How about

      my $test = { 'record' => { 'a' => 11, 'b' => 22 } };

      Or just:

      my $test; $test->{record}->{'a'} = 11; $test->{record}->{'b'} = 22;

      If you want to initialize $test->{record} with something (and don't rely on autovivification), initialize it with {}.