in reply to Find substring based on words and not in charachters

You can feed Algorithm::Diff words instead of lines and it will return you the longest common subsequence through the LCS function.