in reply to Re^3: Help with ReadDir and Stat?
in thread Help with ReadDir and Stat?

You have been a great help - I am learning a lot here. One more question. I am working on the date compare and I am getting errors. Here is what I am trying.
my $lctime = strftime("%m_%d_%y",localtime); my $fltime = strftime("%m_%d_$y",localtime(stat($filename)[9])); if ($lctime = $fltime) { # processs file data }
The Localtime(mtime) returned from the stat function is giving an error. Ideas on this? Thanks, Ad.

Replies are listed 'Best First'.
Re^5: Help with ReadDir and Stat?
by Akoya (Scribe) on Mar 13, 2008 at 18:59 UTC
    localtime returns a list. You need indexes 3, 4, and 5 from that list. You're code can be modified like this:
    my $lctime = strftime("%m_%d_%y",localtime[3 .. 5]); my $fltime = strftime("%m_%d_$y",localtime(stat($filename)[9])[3 .. 5] +); if ($lctime = $fltime) { # processs file data }