my $PERIOD = 10; while (1) { my $mod = time % $PERIOD; sleep $PERIOD - $mod; print scalar localtime, "\n"; }