in reply to calculate date difference

Most negative values in Date::Calc have been addressed in version 5.8 (and up) giving you the N_Delta_YMDHMS () function. All N_ prefixed functions return normalized values, which are guaranteed to be all of the same sign.

my ($D_y, $D_m, $D_d, $Dhh, $Dmm, $Dss) = N_Delta_YMDHMS ( $year1, $month1, $day1, $hour1, $min1, $sec1, $year2, $month2, $day2, $hour2, $min2, $sec2);

From the docs:
... "The return values of this function (including the time differences) are guaranteed to all have the same sign (or to be zero). This is the reason for the "N" that precedes the name of this function, which is intended to mean "normalized" (or "new"). Moreover, the results are guaranteed to be "minimal", in the sense that |$D_m| < 12, |$D_d| < 31, |$Dhh| < 24, |$Dmm| < 60 and |$Dss| < 60 (which is equivalent to $D_m lying in the range [-11..+11], $D_d lying in the range [-30..+30], $Dhh lying in the range [-23..+23], and $Dmm and $Dss both lying in the range [-59..+59])."


Enjoy, Have FUN! H.Merijn