use Data::Dumper; # So that we can inspect our result. # Initial state. my $aref = [ { 'xml_api_reply' => { '-version' => '1', 'weather' => { '-row' => '0', 'current_conditions' => { } }, }, }, ]; # Now add 'report_date' key and its value at the appropriate level. $aref->[0]{'xml_api_reply'}{'weather'}{'report_date'} = { '-data' => '08-19-2012 @ 15:40:26' }; # Inspect the result. print Dumper $aref;