in reply to word based levenstein distance path

Looks straightforward to me. If you operate on an array of words @str instead of a string $str do the following replacements for both strings:

length($str) => scalar(@str) substr($str,$i-1,1) => $str[$i-1]