use Time::Local; my $now=time(); my (@t)=localtime($now); # 8 am today my $next8am=timelocal(0,0,8,$t[3],$t[4],$t[5]+1900); # if after 8am today, add one day in seconds. $next8am+=86400 if ($next8am<$now); sleep ($next8am-$now);