Thanks.. eval works perfectly.
Not really. Why cause an error and then silence *all* errors when it's easier to not cause it in the first place?
my ($cretime) = eval { stat("$SPOOL/$file")->ctime }
or next;
push @files, [ $cretime, $file ];
vs
my $stat = stat("$SPOOL/$file")
or next;
push @files, [ $stat->ctime, $file ];
I used ctime as I want the time that the file was added to the directory by another script.
ctime definitely doesn't return what you want.
$ perl -MFile::stat -le'print "".localtime( stat("a")->ctime )'
Wed Jul 29 12:13:21 2009
$ chmod u+r a
$ perl -MFile::stat -le'print "".localtime( stat("a")->ctime )'
Wed Jul 29 12:13:46 2009
|