use Time::Local; my $now = timelocal(localtime); my $mtime = (stat $file)[9]; my $delta = ($now - $mtime) / (60 * 60 * 24);