http://www.perlmonks.org?node_id=1040793


in reply to Perl Stat Issue

The files are not in the current directory. You need to supply the path to stat as well.

Probably something like:

use File::stat; my $path = '/to/my/directory'; opendir(DIR, $path) or die("Cannot open directory"); my @files= readdir(DIR); closedir DIR; foreach my $file (@files) { my $mod = (stat("$path/$file"))[9]; print "Filename $file has the mod date of $mod \n"; }