in reply to Tuning an approximate match to prefer closer lengths
output: Best word was source1 with an edit distance of 1use Text::Levenshtein qw(distance); $target = 'source'; $best=undef; for (qw(donor_dedupe_source indicted_video_source source1)) { $dist = distance($target,$_); if ($best == undef || $dist < $best) { $best = $dist; $bestword = $_; } } print "Best word was $bestword with an edit distance of $best\n";
|
|---|