Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
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?
LanX oh my god it's full of hacks!!! ...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2017-11-20 21:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (294 votes). Check out past polls.

    Notices?