in reply to Converting a date to a string and back
#!/usr/bin/perl use strict; use warnings; my $TESTFILE='/tmp/x'; unless (-f $TESTFILE){ open(TF, '>',$TESTFILE) or die $!; close(TF); } my $AGE_seconds = -r $TESTFILE ? int( (-M _) *60*60*24) : -1; print "the file $TESTFILE is $AGE_seconds seconds old.\n";
As for the timelocal(), roll your own, with a simple regular expression you are all set. Just be careful to not match a date in the other fields.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Converting a date to a string and back
by choroba (Cardinal) on Jul 14, 2016 at 23:12 UTC | |
by FreeBeerReekingMonk (Deacon) on Jul 15, 2016 at 14:08 UTC |