First of all, let me say that I think you are engagning in false hubris with this since 12 lines in cron or at isn't a very big deal. That said, I often obsess about elegant solutions myself, so what the hell. Any scheduler has to sleep between checks if you don't want to waste cycles. Yet very short sleeps fix this problem. In perl, sleeping for less than a second is somewhat difficult. If it is supported on NT use the 4-argument version of select():
select(undef, undef, undef, 0.25);
or use
Time::HiRes:
use Time::HiRes qw(sleep);
sleep(0.25);
You can also make your sleep time variable; have it sleep an hour if there are over two hours left, 30 minutes for an hour, etc. Once you hit a certain threshold, start using subsecond sleeps.