in reply to diff (different enough)

Perhaps take a look at Algorithm::Diff? You could split up your strings, then pass those sequences to the diff function, which should return the diffs. Perhaps you can use that array returned to determine how different the original strings were?

Here's some code:

use Algorithm::Diff qw/diff/; my $ref1 = [ split //, "foo bar" ]; my $ref2 = [ split //, "foo baz" ]; my @diffs = diff $ref1, $ref2;

Replies are listed 'Best First'.
RE: Re: diff (different enough)
by jettero (Monsignor) on Jul 21, 2000 at 02:44 UTC
    I think we decided below that splits are very expensive. Which makes it very expensive to use that Differ. It also returns a great deal more info than I need. Which makes me think that it probably takes longer than the substr methods below.