omegaweaponZ has asked for the wisdom of the Perl Monks concerning the following question:
This outputs to "Filename, whatever, has the mod date of " Meaning, $mod is blank. I have tried both full directory of /to/my/directory/filename as well and this turns blank too. It seems that "stat" is returning nothing. Any reason this is the case?use File::stat; opendir(DIR, "/to/my/directory") or die("Cannot open directory"); my @files= readdir(DIR); closedir DIR; foreach my $file (@files) { my $mod = (stat($file))[9]; print "Filename $file has the mod date of $mod \n"; }
UPDATE: It seems that actually saying use File::stat is the culript.... when commenting this out, I get an epoch time. Why the heck is this the case? Is File::stat not correctly where I assumed it was?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl Stat Issue
by CountZero (Bishop) on Jun 26, 2013 at 14:59 UTC | |
by omegaweaponZ (Beadle) on Jun 26, 2013 at 15:24 UTC | |
by CountZero (Bishop) on Jun 26, 2013 at 19:10 UTC | |
|
Re: Perl Stat Issue
by Corion (Patriarch) on Jun 26, 2013 at 14:31 UTC | |
by omegaweaponZ (Beadle) on Jun 26, 2013 at 14:36 UTC | |
|
Re: Perl Stat Issue
by thundergnat (Deacon) on Jun 26, 2013 at 14:43 UTC | |
by omegaweaponZ (Beadle) on Jun 26, 2013 at 14:50 UTC | |
|
Re: Perl Stat Issue
by Laurent_R (Canon) on Jun 26, 2013 at 17:59 UTC | |
|
Re: Perl Stat Issue
by daxim (Curate) on Jun 26, 2013 at 14:46 UTC | |
by omegaweaponZ (Beadle) on Jun 26, 2013 at 14:47 UTC |