Hi! I'm using some software within my perl script and need to identify whether in the input file is empty or not before the processing starts. What I've written below isn't working. Is there an easier way to do this than calling the system? I tried opening the file and looking at the first line, but the while loop interferes with my logic.
#!/usr/bin/perl5.8.8 use strict; use warnings; my $cmd = "-s /home/vcg/Documents/Trial/temp"; if (system($cmd) == 0) { print "File exists!"; } else { print "File does NOT exist!";}
Forever Thanks!
In reply to Check for an empty file by Jeri
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |