in reply to How do I test whether a file has write permission?

Another option, if you're interested in determing the actual permissions of the file in a symbolic format (ie. what you'd get back from ls -l):
my $file = "foo"; use Stat::lsMode; my $mode = file_mode($file);
$mode now contains something like "-rw-r--r--".

Replies are listed 'Best First'.
RE: Re: How do I test whether a file has write permission?
by Anonymous Monk on Apr 20, 2000 at 22:15 UTC
    Thanks guys! This is what I was trying to do, and it works! -DataTracer
    if (!(-w FILE)) { print "Content-type: text/plain\n\n"; print "Error: This file does not have write permission!\n"; exit; }