in reply to Checking for Files

You haven't opened the output for write.

it's clearer to use the 3 parameter version of open like this :-

open ( my $fh,'>',$filename) or die "$filename : $!";

Check out the help for open

Replies are listed 'Best First'.
Re^2: Checking for Files
by akrrs7 (Acolyte) on Nov 18, 2011 at 14:04 UTC
    Hello Richard, That works - thanks... However, I am only getting the results for the first line in my input file. Thanks.

      You're opening your output file inside your while loop, so it's getting closed and then wiped out and reopened for each line of your input file. So you're actually getting the size and date of the last file listed in your input file, not the first. Open your output file outside your while loop, as you do with your input file, and that should fix that.

      Aaron B.
      My Woefully Neglected Blog, where I occasionally mention Perl.

      Also - the values that I am getting for filesize and date modified do not match

        So what happens? Are you getting some other file's size/date or are the values completely bogus? That ctime function (where's that from anyway?) applied to mtime looks dubious. I assume use have left out a "use File::stat" too?