in reply to Extract the lines

In the documentation of Date::Calc, there is a recipe for just this question:

How do I check whether a given date lies within a certain range of dates?

use Date::Calc qw( Date_to_Days ); $lower = Date_to_Days($year1,$month1,$day1); $upper = Date_to_Days($year2,$month2,$day2); $date = Date_to_Days($year,$month,$day); if (($date >= $lower) && ($date <= $upper)) { # ok } else { # not ok }

There are other modules like Date::Manip or Class::Date if you want alternatives, but it is sensible to use a module instead of "reinventing the wheel"