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, #... )
|
|---|