Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re: comparing keys and values in different hashes

by fruiture (Curate)
on Mar 03, 2003 at 14:04 UTC ( #240029=note: print w/replies, xml ) Need Help??

in reply to comparing keys and values in different hashes

You're very close:

foreach( keys %hash2 ){ if( exists $hash1{$_} ){ print "$_ = ",$hash2{$_}*$hash1{$_},"\n"; } }

btw.: please don't quote numbers (like '5') if you want them to be numbers and not strings: It's both confusing and (although only in microseconds) slows perl down.

my %hash = ( dog => 11, budgie => 1, #... )

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://240029]
[Corion]: Hi marto!
[Corion]: I just found out that in $current_top_prior ity_project , the part I am in is not even in the top three worries. That's somewhat bad, not because I'm happy with being a top worry but because that means that I don't even know how bad the rest ...
[Corion]: ... of the situation is :-)

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (7)
As of 2017-07-26 08:08 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (385 votes). Check out past polls.