in reply to How to add timer

You could use alarm to send SIGALRM after an hour and in you alarm handler update the timestamp and set another alarm.

If your objective is only to prevent multiple concurrent executions of your program, then you might find File::Pid or one of the other pid modules does what you need.