`1) How do I compare two dates?
Solution #1:
use Date::Calc qw( Date_to_Days );
if (Date_to_Days($year1,$month1,$day1) <
Date_to_Days($year2,$month2,$day2))
if (Date_to_Days($year1,$month1,$day1) <=
Date_to_Days($year2,$month2,$day2))
if (Date_to_Days($year1,$month1,$day1) >
Date_to_Days($year2,$month2,$day2))
if (Date_to_Days($year1,$month1,$day1) >=
Date_to_Days($year2,$month2,$day2))
if (Date_to_Days($year1,$month1,$day1) ==
Date_to_Days($year2,$month2,$day2))
if (Date_to_Days($year1,$month1,$day1) !=
Date_to_Days($year2,$month2,$day2))
$cmp = (Date_to_Days($year1,$month1,$day1) <=>
Date_to_Days($year2,$month2,$day2));
Solution #2:
use Date::Calc qw( Delta_Days );
if (Delta_Days($year1,$month1,$day1,
$year2,$month2,$day2) > 0)
if (Delta_Days($year1,$month1,$day1,
$year2,$month2,$day2) >= 0)
if (Delta_Days($year1,$month1,$day1,
$year2,$month2,$day2) < 0)
if (Delta_Days($year1,$month1,$day1,
$year2,$month2,$day2) <= 0)
if (Delta_Days($year1,$month1,$day1,
$year2,$month2,$day2) == 0)
if (Delta_Days($year1,$month1,$day1,
$year2,$month2,$day2) != 0)
`