I have a process run weekly where I must convert data formats for about thirty files. I read a text file that provides all of the filenames and switch settings.
My perl code is:
for ($j = 1; $j <= $k; $j++)
{
open(FIN2,$fin2) || die "open: $!";
do other stuff
}
Every once in a while, one of the files is empty, & this is ok.
But the perl program aborts at that open line. Right now, when this happens, I simply remove the file info from the text file listing, and restart. But, I must remember to put the line(s) back in for the next week.
QUESTION:
is it better to do a "next" when the file open fails, or
do some kind of File::stat command to know if the file exists first
In shell scripting, one can do an "if [ -e filename ] " kind of thing