... my $targettimetext = "13:14:15"; # Turn target time into seconds my @tttparts = split/\:/, $targettimetext; my $targettime = ($tttparts[0] * 3600) + ($tttparts[1] * 60) + $tttparts[2]; ... while(1) { # Turn the current time into seconds my ($sec,$min, $hour, $mday,$mon, $year, $wday,$yday, $isdst) = localtime time; my $nowtime = ($hour * 3600) + ($minute * 60) + $sec; # Not yet time to do things? Sleep until it is if($nowtime < $targettime) { sleep($targettime - $nowtime); } # YOUR STUFF HERE # Recalculate the current time after doing stuff ($sec,$min, $hour, $mday,$mon, $year, $wday,$yday, $isdst) = localtime time; $nowtime = ($hour * 3600) + ($minute * 60) + $sec; # Sleep for the rest of the day sleep(86400 - $nowtime); }