my $top_at_hour = 4; while ((localtime(time))[2] < $stop_at_hour) { # do some specific stuff here.. } exit; #### -- Joost downtime n. The period during which a system is error-free and immune from user input.