#!/usr/bin/perl use strict; my %hash_1 = ( 'a' => 'b', 'c' => 'd', 'e' => 'f' ); my %hash_2 = ( 'a' => 'J', 'e' => 'K' ); my %new_hash; $new_hash{$_} = $hash_2{$_} ? $hash_2{$_} : $hash_1{$_} for keys %hash_1; print map { $_ => " => " . $new_hash{$_} . "\n" } keys %new_hash;
In reply to Re: merging two hashes and updating the 1st hash keys.
by bichonfrise74
in thread merging two hashes and updating the 1st hash keys.
by sathiya.sw
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |