Hi Athanasius!
I tested the -s operator on my Windows system with a null file (zero length). I do get a numeric 0 for a null file. Here is the test code. I did verify that 'zero' is indeed of 0 length with file manager. I think -s returns undef if the file does not exist (which is different than exists, but empty).
#!usr/bin/perl
use warnings;
use strict;
`copy NUL zero`; #create empty file cp dev/null zero on unix?
my $size = -s 'zero';
print $size; #does print "0"
__END__
0
Update: FYI for Windows users who don't use the command line much... NUL is a reserved word in the Windows file system for "the bit bucket". Unix folks are familiar with this concept, but sometimes Windows users aren't. someprogram > NUL does not create a file called "NUL", this just throws away STDOUT and it goes nowhere, i.e., the "bit bucket". There is no file called "NUL". To make an empty file, I copied the "bit bucket" to a file.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|