if i understood it correctly, you want lines matching specific time interval.
- get rid of Date::Manip, just calc your start time directly ($start = time - $n * 86_400)
- use Time::Local::timegm to convert timestamp to epoch
- compare epoch times (numbers)