use Time::Local; my $time1 = timelocal($sec1,$min1,$hour1,$mday1,$mon1,$year1); my $time2 = timelocal($sec2,$min2,$hour2,$mday2,$mon2,$year2); if ($time1 > $time2) ...