jackjohnson44
asked on
perl have function run every hour
I have a loop in perl which pretty much goes forever. I have a sleep in this function, which also gets a webpage, so I don't really know how long each loop takes. I would like my script to call a function every hour (or close to each hour). How can I do this using a loop?
sleep 60*(60-(localtime)[1]);
ASKER
I can't have a sleep because my function is already looping. I just want it to check inside the loop if it is 1 hr after the program started. If it is, call a page, reset the timer and check each loop until 1 more hour goes by.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks a lot, it worked well, but what does that ^ mean?
I tried googling it, but it must get stripped out.
I tried googling it, but it must get stripped out.
perldoc perlvar
$BASETIME
$^T The time at which the program began running, in seconds since
the epoch (beginning of 1970). The values returned by the -M,
-A, and -C filetests are based on this value.
$BASETIME
$^T The time at which the program began running, in seconds since
the epoch (beginning of 1970). The values returned by the -M,
-A, and -C filetests are based on this value.