Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Perl Stat Issue

by thundergnat (Deacon)
on Jun 26, 2013 at 14:43 UTC ( [id://1040793]=note: print w/replies, xml ) Need Help??


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"; }

Replies are listed 'Best First'.
Re^2: Perl Stat Issue
by omegaweaponZ (Beadle) on Jun 26, 2013 at 14:50 UTC
    I tried this. It also comes back completely blank, as if File::stat has some critical error even though it seems up to date. This is my output. $stat is just not working. What is the best way to diagnose this?
    Use of uninitialized value in concatenation (.) or string at test.pl l +ine 11. Filename test.txt has the mod date of

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1040793]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2024-04-23 20:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found