in reply to Is the file there?
... open(TESTFILEHANDLE, "<$yourfilename") && die "$!, $yourfilename already exists.\n"; ...The && die... will kill the program and display the message, IF AND ONLY IF, the file was successfully opened (readonly), which in your case, is what you wanted. You can also replace the "die" keyword with "warn" if you don't want to kill the program.
|
---|