in reply to searching through data
Given that your search loops don't depend on it being sorted, I'd suggest removing that "optimisation" and seeing how that affects your timings.
As an aside, how many lines are there in your input file?
--
use JAPH;
print JAPH::asString();
|
|---|