in reply to Re: Finding a LCS module on word level
in thread Finding a LCS module on word level
Algorithm::Diff finds the longest common subsequence, which is not necessarily the same as the longest common substring. So, I don't think it's what the OP is looking for, even though the result obtained with the given sample strings does look correct... (as in this particular case, the longest common subsequence also is the longest common substring). This is not always true, however. For example, try modifying $str2 to read "a perl monk". Algorithm::Diff::LCSidx will (correctly) identify this longest common subsequence:
a perl monk[5,10,11]
which is not a substring of $str1...
|
|---|