|Perl Monk, Perl Meditation|
Re^3: searching for a pattern using suffix arrays (better)by tye (Sage)
|on Oct 09, 2013 at 02:46 UTC||Need Help??|
Yeah, I can see value in getting the binary search to find the "first" potential match; especially how you've avoided using the regex within it.
Many decent improvements.
bsearch() is still accessing @suff like a global variable. You may have decided that that is fine.
though not for any compelling reasons.
Your bsearch() now returns the first potential match (the first suffix after or equal to your search), so you might want to adjust your output for the case of no matches.
The return value from bsearch() might be an error message but you unconditionally use it as a number. If Modern::Perl doesn't turn on warnings, then you should probably do that.
can be shortened as: