![]() |
|
Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
hash comparisonby sarvan (Sexton) |
on Jul 25, 2011 at 05:52 UTC ( #916487=perlquestion: print w/replies, xml ) | Need Help?? |
sarvan has asked for the wisdom of the Perl Monks concerning the following question:
Hi there,
I have the following script.
This scripts i m writing to find similarity between two sentences. The two sentences are stored in $candidate and $reference variables. In the current script i made the program to count the occurence of each type of word and stored them in a hash.. Now,each hash has the words and its count from both candidate and reference sentences. The help in need is, i want to take each words in the candidate and compare that with the two hashes to find the maximum reference count. for eg. if i have the word called "the" in candidate,i want to find the count of this word in %candidate hash as well as %reference hash and i want to take the minimum values(i.e if 2 and 5 is the count of "the" in two hashes i want 2.) out of this two counts. likewise for all words in the candidate.. Plz help me in this.. thanks
Back to
Seekers of Perl Wisdom
|
|