my %hash1 = ( 700200 => '523235', 700204 => '523221', ); my %hash2 = ( 523235 => 'Title1', 523221 => 'Title2', ); #### my $value1; foreach my $key1 (keys(%hash1)) { $value1 = $hash1{key1}; foreach my $key2 (keys (%hash2)) { if ($value1 eq $key2){ $hash3{$key1}= $hash2{$key2}; } } } print Dumper \%hash3; #this should be the expected result $VAR1 = { 700200 => 'Title1', 700204 => 'Title2', };