in reply to Re^2: Comparison between keys in hash
in thread Comparison between keys in hash

Then I would change your hash to:

$counting{word}{$word}{str1}=$counter; $counting{word}{$word}{str2}=$counter;

And then (see here for min function examples):

foreach my $word (keys %{$counting{word}}) { print "$word\t", min ($counting{word}{$word}{str1}, $counting{word}{$word}{str2}) }

Replies are listed 'Best First'.
Re^4: Comparison between keys in hash
by sarvan (Sexton) on Jul 07, 2011 at 06:14 UTC
    hi i5513,

    Thanks for the code.. And in the context of my whole program,and ur changes in hash implementation, Is that $counter is same as $t1. because in my hash i store keys as ($occurence) and values as $t1.

    And also if possible can u put this in the code of mine. Sorry, i m really weak in perl.. that's why coundn't understand. Plz dont mind.

      Sorry but like others told you , we won't make your homework.
      RTFM and play with your code until you got the result.

      PD: Please tell me if pointer to RTFM is not a proper way to use perlmonnks ... I supersearched it and appears many entries, so I think it is ok ...
        Okay.

        Atleast let me know what the hashes u created will do and what the foreach is intended for.

        I can understand little bit. But not fully. Just explain me. I will try it