NodeReaper has asked for the wisdom of the Perl Monks concerning the following question:

This node was taken out by the NodeReaper on Mar 24, 2010 at 13:00 UTC
  • Comment on Reaped: How do I make all the keys in %a with common keys in %b equal to %b's values?

Replies are listed 'Best First'.
Re: How do I make all the keys in %a with common keys in %b equal to %b's values?
by ungalnanban (Pilgrim) on Mar 24, 2010 at 09:33 UTC

    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--
Re: How do I make all the keys in %a with common keys in %b equal to %b's values?
by apl (Monsignor) on Mar 24, 2010 at 12:01 UTC
    If you were doing it by hand, what steps would you take?