|more useful options|
Re^2: comparing files based on timestampsby Marshall (Canon)
|on Apr 02, 2009 at 08:19 UTC ( #754890=note: print w/replies, xml )||Need Help??|
This is a very good idea. item 9 from the list slice is the mtime. This line will produce something like:
Mon Nov 12 23:21:31 2007. If you want to get some numbers to make comparison easier, continue using list slice like this:
Only create the variables of interest to you. If you don't need the day of week, then don't use index 6. Note that months will wind up being 0-11 and year is real year-1900. Also note that the slice values don't have to be in order. I organize the lvalues then figure out the order of the slice values. It is not possible for the slice values in ".." sequence to go backwards 4..6 works but 6..4 doesn't work, at least with the versions of Perl I use.
Update: I would keep the values as UTC rather than localtime like above use gmtime. Strangely enough if I remember right, gmtime and timegm are in Time::Local; so if my memory is right, watch out for that!
Little tired today but also consider converting to epoch seconds.
This gives a single integer value that is easily compared.
In Section Seekers of Perl Wisdom