according to Programming Perl (p. 98)...
-w = file is writable by effective uid/gid
-s = file has nonzero size (returns size)
-w only tells if the file's permissions allow it to be written to, has
nothing to do with whether or not it already has data.
save the return value of -s and check that v
e modification time, in days.
-A Same for access time.
-C Same for inode change time (Unix, may differ for other
platforms)
-Original Message-
From: Dave Adams [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 30, 2005 11:16 AM
To: beginners perl
Subject: File Test Quest
Dave Adams wrote:
> *My Code:*
>
> my $logfile = "logfile_with_content";
> if (-w $logfile) {
> print ("True - file exists but empty");
> }
> if (-s $logfile) {
> print ("True - file exist and has content");
> }
>
> *My Output:*
>
> True - file exists but empty True - file exist and has
*My Code:*
my $logfile = "logfile_with_content";
if (-w $logfile) {
print ("True - file exists but empty");
}
if (-s $logfile) {
print ("True - file exist and has content");
}
*My Output:*
True - file exists but empty True - file exist and has content
*My Question:*
Why do both test ev