http://www.perlmonks.org?node_id=830494


in reply to Reaped: How do I make all the keys in %a with common keys in %b equal to %b's values?


Use the following way to achieve your requirement
my %one = ( "one" => 1, "two"=> 2, "three"=> 3, "four" =>4, "fice" => 5, ); my %two = ( "one" => A, "two"=> B, "iii"=> C, "iv"=> 4444, "v"=> 5555, ); my @common = grep exists $one{$_}, keys %two; @one{@common} = @two{@common};
--$ugum@r--
  • Comment on Re: How do I make all the keys in %a with common keys in %b equal to %b's values?
  • Download Code