Posted on 2005-04-07 20:58:34-07 by tembe
Help to use String::Approx
Hello, I installed String::Approx and it seems to be functional. Just as a check, I am trying to run different utilities such as adist, aindex etc. by following the examples on CPAN's string::approx page and can't seem to run aslice utility. For the following code, adist and aindex seem to work fine. But aslice outputs something unexpected. $F = "xxxx"; $S = "zzzxxyxyyy"; print "Edit = ", adist($F, $S), "\n"; $index = aindex($F, $S); print "Matches at ", $index, "\n"; ($index, $size) = aslice($F, $S); print "Matches at ", $index, "\tSize is ", $size, "\n"; ($index, $size, $d) = aslice($F, $S); print "Matches at ", $index, "\tSize is ", $size, "Distance is ", $d, "\n"; output: Edit = 1 Matches at 3 Matches at ARRAY(0x9cc9d98) Size is Matches at ARRAY(0x9ddfbc0) Size is Distance is Any help to fix this and to use Approx utility for: 1. Extracting the approximate match from $S 2. At least finding the length of the match and correct index in $S will be appreciated. Thanks. Tembe
Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.