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,
For extra credit, leave out the "1 ==" part ;-)use Text::Levenshtein qw/distance/; sub off_by_one { 1 == distance("foo bar baz", shift); }
After Compline,
Zaxo
|
|---|