You can just replace die with the name of the sub you want to run. You can put practically any command you want after the ||. There is nothing intrinsically special about the open||die pairing, it's just a common convention used to handle errors.
sub dontdie() { print "I didn't die\n"; } open(LOK, ">>C:\\Perl\\RTEOlock\\check\\RTEOlock.log") || dontdie();
In reply to Re: Calling a custom sub on failure
by pzbagel
in thread Calling a custom sub on failure
by Red_Dragon
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |