in reply to Re: Re: Replace the value of a hash
in thread Replace the value of a hash

Yes, that's true.

Then, if you need a solution that will give you

+{ 'b' => 'B', 'a' => 'A', 'c' => 3 };

from the above data, the best is probably a straightforward solution like

while (my ($key, $val)= each %hash1) { exists $hash2{$val} and $hash1{$key}= $hash2{$val}; }

As this

{ my %thash= (map (($_,$_), values %hash1), %hash2); @hash3{keys %hash1}= @thash{values %hash1}; }

is not only difficult to read, but also inefficent depending on your data.