Is there an easy way to set the priority of a process through Perl? As the comments above said, I don't think there is a way to 100% ensure that your script won't be interrupted, but renice-ing it to a higher priority might help.
It can help /only/ if the "time of check" and the "time to use" are very close. However, if this program is doing many things in the meanwhile (like checking other process, reading a file, etc), renicing is not going to help.