unless ( open(LOK, ">>C:\\Perl\\RTEOlock\\check\\RTEOlock.log") ) { # do what ever we can not open the file ... }