use Date::Manip; my $now = time(); my $next = &UnixDate(&ParseDate("8am"), "%s"); $next += 24 * 60 * 60 if $next < $now; sleep($next - $now);