If the list is huge, would it be very slow?

Quite possibly. There’s a discussion in String::Approx#CONTROLLING-THE-CACHE about the tradeoffs between memory and running time.

If we just wanted to get the first match from @list and return the result, is there a way to do that?

From the documentation, this doesn’t seem to be possible, no. :-( When called in scalar context, the amatch function returns a single value, but that value is just true or false to indicate whether or not any matches were found.

Note: Before committing to this module, you should read String::Approx#DESCRIPTION carefully and consider the alternatives. Depending on your requirements, a module such as Text::Levenshtein might suit you better.

Hope that helps,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,


In reply to Re^3: Getting matched word from String::Approx by Athanasius
in thread Getting matched word from String::Approx by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":