Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
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 ( [id://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--

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2024-03-19 05:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found