Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

(dkubb) Re: (2) Answer: How do I make all the values in %a with common keys in %b equal to %b's keys?

by dkubb (Deacon)
on Mar 30, 2001 at 12:49 UTC ( [id://68313]=note: print w/replies, xml ) Need Help??


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

Here's another way to do that:

foreach my $key (keys %a) { $a{$key} = $b{$key} if exists $b{$key}; }

or

exists $b{$_} and $a{$_} = $b{$_} for keys %a;
  • Comment on (dkubb) Re: (2) Answer: How do I make all the values in %a with common keys in %b equal to %b's keys?
  • Select or Download Code

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2024-04-25 21:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found