in reply to Calling a custom sub on failure

First, it's usually a good idea to use the lower-precedent version of || in instances like this. It is spelled or. This allows you (or perhaps some poor maintenance programmer) to remove the ()'s around open's arguments without making bad things happen.

Second, what did you try? What's the obvious and simple answer? It's quite easy:

    open LOK, ">>C:\\Perl\\RTEOlock\\check\\RTEOlock.log" or my_sub($!);

Update: I guess I should refresh my browser tabs more often. I'm not quite sure how I managed to reply an hour later without noticing other replies saying the same thing. :)