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 :)
In reply to Re: How do I test if a file has write permission?
by fx
in thread How do I test if a file has write permission?
by ChuckularOne
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |