<?xml version="1.0" encoding="windows-1252"?>
<node id="191184" title="Re: comparing size" created="2002-08-19 10:19:39" updated="2005-06-09 01:53:23">
<type id="11">
note</type>
<author id="128665">
gav^</author>
<data>
<field name="doctext">
To find the size of a file you can use:
&lt;code&gt;my $size = -s $file;
&lt;/code&gt;
The -X file tests are documented &lt;a href="http://www.perldoc.com/perl5.8.0/pod/func/-X.html"&gt;here&lt;/a&gt;.
&lt;p&gt;
You could also use the core module &lt;a href="http://www.perldoc.com/perl5.6.1/lib/File/stat.html"&gt;File::stat&lt;/a&gt;
which provides dev, ino, mode, nlink, uid, gid, rdev, size, atime, mtime, ctime, blksize, and block. I tend to find this
easier than remembering what order 
&lt;a href="http://www.perldoc.com/perl5.6.1/pod/func/stat.html"&gt;stat&lt;/a&gt;
returns things.
&lt;code&gt;use File::stat;
my $st = stat($file);
my $size = $st-&gt;size;
&lt;/code&gt;
&lt;p&gt;gav^</field>
<field name="root_node">
191173</field>
<field name="parent_node">
191173</field>
</data>
</node>
