in reply to Re: Fastest way to find the mismatch character
in thread Fastest way to find the mismatch character

And this approach has (what may be) the advantage that the strings being compared need not be equal in length as in the bitwise-xor approach. E.g., try:

my @strings = ( "This is the wild cat", "Thsi is the house cat", );

Replies are listed 'Best First'.
Re^3: Fastest way to find the mismatch character
by Anonymous Monk on Jul 08, 2011 at 13:32 UTC

    And this approach has (what may be) the advantage that the strings being compared need not be equal in length as in the bitwise-xor approach.

    That is not a limitation of bitwise-xor in perl

      What I might better have written was that mismatching substrings do not have to be the same length in the strings being compared. Consider the approach of Re: Fastest way to find the mismatch character with the input strings:

      my $varA = 'This is the wild cat'; my $varB = 'Thsi is the house cat';

      The naive bitwise approach used does not allow for 're-synchronization' after mismatching substrings of differing length, so the output does not seem to be what is desired:

      Th<mismatch>si</mismatch> is the <mismatch>house cat</mismatch>

      (Of course, the OPer may not need this sort of feature at all, in which case: No problem!)