in reply to off-by-one string comparison

Text::Levenshtein implements a well-known metric for difference between strings.

$ perl -MText::Levenshtein=distance -e'print distance( "foo bar baz"," +fooo bar baz"),$/' 1 $

So your off-by-one test could be written,

use Text::Levenshtein qw/distance/; sub off_by_one { 1 == distance("foo bar baz", shift); }
For extra credit, leave out the "1 ==" part ;-)

After Compline,
Zaxo