in reply to
Re: Matching bits of 2 strings
in thread Matching bits of 2 strings
You've beaten me to the use of C. I remembered that it would be faster to call an XS (or Inline::C) function here. However, I'd like to point out that using tr/// for this problem is not a help at all. Using tr/\0// merely tells you how many characters are the same between the two words in total, not how many characters are the same at the start of the string. This is the fatal flaw. I believe this flaw existed in the LCS presentation at a YAPC in years gone by.
Example: calling the function with "brought" and "wrought" should return 0, except that the tr/// solution returns 6.