# no need for this loop: # for my $w_data (@$weather_data) { # push @data, $w_data; # } # Now add 'report_date' key and its value at the appropriate level. #push @data, $weather_data->[0]{'xml_api_reply'}{'weather'}{'report_date'} = { '-data' => $today #}; push @{$weather_data->[0]{'xml_api_reply'}{'weather'}{'report_date'}}, { '-data' => $today }; # print Dumper(\@data); print Dumper(\$weather_data);