Perl: the Markov chain saw | |
PerlMonks |
Re: How do I test if a file has write permission?by fx (Pilgrim) |
on Dec 19, 2003 at 23:35 UTC ( [id://315951]=note: print w/replies, xml ) | Need Help?? |
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 Section
Seekers of Perl Wisdom
|
|