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 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?
>

-w tests whether the file is writable by the current effective UID/GID,
it has nothing to do with the contents of the file.

perldoc -f -e

For more details.

http://danconia.org

> Thanks
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to