<?xml version="1.0" encoding="windows-1252"?>
<node id="240029" title="Re: comparing keys and values in different hashes" created="2003-03-03 09:04:52" updated="2005-06-04 20:02:52">
<type id="11">
note</type>
<author id="127435">
fruiture</author>
<data>
<field name="doctext">
&lt;p&gt;You're very close:&lt;/p&gt;
&lt;code&gt;
foreach( keys %hash2 ){

   if( exists $hash1{$_}  ){

      print "$_ = ",$hash2{$_}*$hash1{$_},"\n";
   }
}
&lt;/code&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;code&gt;
my %hash = (
    dog =&gt; 11,
    budgie =&gt; 1,
   #...
)
&lt;/code&gt;
-- &lt;br/&gt;
http://[fruiture].de</field>
<field name="root_node">
240025</field>
<field name="parent_node">
240025</field>
</data>
</node>
