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 value to see if the file has data or not On 11/30/05, Dave Adams <[EMAIL PROTECTED]> 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 content > > *My Question:* > > Why do both test evaluate to true when the file called > "logfile_with_content" is 5K in size? I would expect the second file test > to only work? Any advice? > > Thanks > > -- since this is a gmail account, please verify the mailing list is included in the reply to addresses -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>