in reply to How to campare two variable consist line and print difference

Hmm, it is a bit difficult to state the position of an unmatched text pattern... More generally, the idea should probably be to use a regex to check if you can match "doesn't" or "don't", but you don't give enough details on the circumstances. May be something like:
if ($string =~ /doesn't/ or $string =~ /don't/) { do_something(); } else { something_else(); }

Replies are listed 'Best First'.
Re^2: How to campare two variable consist line and print difference
by GrandFather (Saint) on Sep 15, 2014 at 09:19 UTC

    Consider:

    my $str1 = "The device doesn't allow writes and that's causing this is +sue."; my $str2 = "The device allow writes and that's causing this issue."; my $str3 = $str1 ^ $str2; print "Difference found at $+[0]\n" if $str3 =~ /^(\0+)/;
    Perl is the programming world's equivalent of English