# This is from memory and almost certainly contains bugs use Time::Local; $now = time; @now_array = localtime($now); # 1:00am is tomorrow if it is after that today if($now_array[2] >= 1) { $now_array[3]++; } # Set 1:00am in the structure $now_array[2] = 1; $now_array[1] = 0; # Convert to seconds $then = timelocal(@now_array); # Now wait sleep($then - $now);