in reply to Finding the difference between 2 dates in seconds

Or try Date::Calc for similar effect as the previous response.
#!/usr/bin/env perl # use strict; use warnings; use Date::Calc qw/ Mktime /; my $date1 = "Aug 26 23:10:59"; my $date2 = "Aug 27 10:59:02"; # assume that the year needed is 2007; my $year1 = my $year2 = 2007; sub split_date_str { my %months = ( Jan => 1, Feb => 2, Mar => 3, Apr => 4, May => 5, J +un => 6, Jul => 7, Aug => 8, Sep => 9, Oct => 10, Nov => 11, + Dec => 12 ); my $str = shift; my @f = split /\s+/, $str; my $month = $months{$f[0]} || die "invalid month in string: '$str' +\n"; ($month, $f[1], split(/:/, $f[2])); } my $diff = Mktime( $year2, split_date_str($date2) ) - Mktime( $year1, + split_date_str($date1) ); print $diff,"\n";