in reply to Number of matching words
Algorithm::HowSimilar or Algorithm::LCSS may be what you are after.
cheers
tachyon