in reply to calculate matching words/sentence

It sounds like you're working along the lines of a vector search engine. If you haven't already read it, then Building a Vector Search Engine in Perl, a perl.com article, should give you some interesting ideas.

--
[ e d @ h a l l e y . c c ]