compare the date with your target-dates (Date::Calc has some handy functions for this, e.g. Delta_YMDHMS
)
process the fitting lines
Of course you can optimize due to the knowledge that your lines are sorted, e.g. abort processing once you found a line with a date later than your second one ....
HTH, Rata