use Text::Levenshtein qw(distance); print distance("foo","four"); # prints "2"