in reply to pattern matching

The above links are certainly worth reading. Asking a well formed, properly supported question is important. It saves the monk reading your post time and confusion, and improves the quality of the replies you will receive. This saves both you and the monks that peruse your question time. We all like saving time ;)

As for your question, I'm not certain what you are asking, but you might consider String::Similarity. It will provide you with an estimate of the difference between the two strings. I'm not terribly familiar with the module, so I can't offer much more than to point you in the direction of it.