my %h1 = ( "one" => 1, "two" => 2, "three" => 3, ); my %h2 = ( "four" => 4, "five" => 5, "six" => 6, "one" => 2222, ); #### $VAR1 = { 'one' => [ 1, 2222 ] 'two' => 2, 'three' => 3, 'four' => 4, 'five' => 5, 'six' => 6, }; #### #!/usr/bin/perl -w use strict; use Data::Dumper; my %h1 = ( "one" => 1, "two" => 2, "three" => 3, ); my %h2 = ( "four" => 4, "five" => 5, "six" => 6, "one" => 11111, ); foreach my $x ( keys %h2 ){ push @{ $h1{$x} }, $h2{$x}; } print Dumper (\%h1); #### Can't use string ("1") as an ARRAY ref while "strict refs" in use at slice_hash.pl line 48 #### $VAR1 = { 'three' => 3, 'five' => [ 5 ], 'six' => [ 6 ], 'one' => 1, 'two' => 2, 'four' => [ 4 ] };