Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^3: Comparison between keys in hash

by i5513 (Pilgrim)
on Jul 06, 2011 at 16:40 UTC ( #913021=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2023-12-10 10:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?











    Results (39 votes). Check out past polls.

    Notices?