use Date::Calc qw(Delta_DHMS); $start_time = "16:54:23"; $end_time = "16:54:28"; @random=(2001,1,1); #Any value to allay the ymd filler push @end, @random, split/:/, $end_time; push @start, @random, split/:/, $start_time; @diff=Delta_DHMS(@start,@end); print join":",@diff[1..3];