http://qs321.pair.com?node_id=1009885

supriyoch_2008 has asked for the wisdom of the Perl Monks concerning the following question:

Hi Perlmonks,

I am interested to find out the matching words between an original text and a new text and the percentage of matching words over the total words in new text. For example, I have an original text like $a="Poet Blake had a milky white cat. He used to call it Pussy."; and a new text like $b="Poet Blake had a white cat and used to call it Pussy."; The words that matched between these two texts are 11 i.e. Poet, Blake, had, a, white, cat, used, to, call, it, Pussy. Moreover, there are 12 words in new text $b. Thus, the percentage of matching words over the new text will be=(11/12)*100 i.e. 91.67%. Is it possible to get these results using a perl program? This question is in continuation of one of my earlier nodes. I tried with a script that made use of a module called plagiarized.pm. but failed. I am at my wit's end to get the desired results. I got some suggestions in this regard from perlmonks earlier. But I failed to write a working script for the desired results. Is it possible to use a simple script in perl to find the matching words between two texts and the percentage of matching words?