<p>Perl has a set of useful File Test Operators that can be used to quickly get information about the file system like the existence of a file, or the size. Lets take a quick look at how to get the file size in bytes using File Test Operators.</p><pre><code> #!/usr/bin/perl -w\n \n $filename &#61; &#39;/path/to/your/file.doc&#39;;\n $filesize &#61; -s $filename;\n print $filesize; </code></pre> Simple enough, right? First you create a string that contains the path to the file that you want to test, then you use the <b>-s</b> File Test Operator on it. You could easily shorten this to one line using simply: <pre><code> print -s &#39;/path/to/your/file.doc&#39;; </code></pre> Also, keep in mind that this will always return true if a file is larger than zero bytes, but will be false <a href="https://www.thoughtco.com/uploading-files-with-php-2693794" data-inlink="n2gect-iUJHfy4elAtgPVQ&#61;&#61;" data-component="link" data-source="inlineLink" data-type="internalLink" data-ordinal="1">if the file size</a> is zero. It makes a handy and quick way to check for zero byte files.