for my $hash1 (@{$data1}){ for my $hash2 (@{$data2}){ for my $key (keys %$hash2){ $hash1->{$key}=$hash2->{$key}; } } } print Dumper $data1;