in reply to How do I test if a file has write permission?
Another, but probably less efficient way, is to open the file in append mode. If the open fails the file COULD be read-only:
open(FILE, ">>some_file.txt") || print "File is read only";
The advantage of this way, I suppose, is that if you really want to write things to the end of the file then it's now open :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Answer: How do I test if a file has write permission?
by exussum0 (Vicar) on Dec 20, 2003 at 20:58 UTC |