in reply to compare strings intuitively
There's also String::Approx, whose measure of similarity/approximateness is based on the Levenshtein edit distance. The default approximateness for a match is 10%, but you specify other values (see the docs).
use String::Approx qw(amatch adist); my $str1 = "dn despaigne"; my $str2 = "dan despaigne"; print "matched\n" if amatch($str1, $str2); print "matched\n" if amatch($str1, ["5%"], $str2); printf "distance = %d\n", adist($str1, $str2); # number of edits requi +red
|
|---|