Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

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 ( #830494=note: print w/ replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://830494]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2014-10-25 21:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (149 votes), past polls