Algorithm::HowSimilar or Algorithm::LCSS may be what you are after.
cheers
tachyon
In reply to Re: Number of matching words by tachyon in thread Number of matching words by Anonymous Monk