http://www.perlmonks.org?node_id=463739

argv has asked for the wisdom of the Perl Monks concerning the following question:

I want to see if a given string is off by 1 character from the test string. Thus, If my test string is "foo bar baz", I want to have a function that matches any one of:

fooo bar baz foo bar baaz foo bbar baz [etc]

Here, I'm looking for off-by-one errors. Extra bonus for a function that matches if it's off by an arbitrary N. That is, a function that returned the number of characters that were different between the strings rather than just a binary true/false.