... while (1) { do_work; if (-f '/tmp/script.die.die.die') { unlink '/tmp/script.die.die.die'; last; } ...