in reply to how to get the time difference

Whilst using modules has already suggested and is a good solution to the problem, it's also possible to do this without modules. You just need to convert your time strings to seconds.

my ($h, $m, $s) = split /:/, $your_time_goes_here; my $secs = $s + ($m * 60) + ($h * 60 * 60);

You can then get the number of seconds between two times by subtracting.

Of course, this gets more complicated if your timestamps span midnight or if you need to take into account daylight savings time or leap seconds. In those cases, you should definitely use something like DateTime::Duration.

--
<http://dave.org.uk>

"The first rule of Perl club is you do not talk about Perl club."
-- Chip Salzenberg