It's a little unclear to me if Text::Fuzzy does what you want, but of course investigating CPAN modules is a good idea.
Also, just a note that the code above is only an interpretation if what your original code appears to want to do, i.e. looking at only the first two names for matches.
A more complete selection of sample input, description of what you want the match to be, and sample output would really help, I think.
In reply to Re^3: Searching for best match
by Anonymous Monk
in thread Searching for best match
by Sosi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |