How about:
use Time::Piece;
my $d1 = '2013-05-21 07:47:21';
my $d2 = 'Thu Aug 1 09:53:40 2013';
my $t1 = Time::Piece->strptime($d1, "%Y-%m-%d %T");
my $t2 = Time::Piece->strptime($d2, "%c");
say $t2->epoch - $t1->epoch;
output:
6228379
Time::Piece documentation