Sometimes you just want to know the age of a file in seconds:

perl -e 'print (int((-M shift)*60*60*24)||1)' script_file

The ||1 is to ensure a positive number. You can leave it out. To get the file age in minutes:
perl -e 'print (int((-M shift)*60*24))' script_file

Replies are listed 'Best First'.
Re: file age in seconds using M file test
by Athanasius (Archbishop) on Apr 16, 2015 at 02:14 UTC
Re: file age in seconds using M file test
by jeffa (Bishop) on Apr 16, 2015 at 15:22 UTC

    I like to abstract details like 60*60*24 when i can:

    perl -MTime::Seconds -le'print( (-M shift) * ONE_DAY )' file perl -MTime::Seconds -le'print( (-M shift) * ONE_DAY / ONE_MINUTE )' f +ile

    jeffa

    L-LL-L--L-LL-L--L-LL-L--
    -R--R-RR-R--R-RR-R--R-RR
    B--B--B--B--B--B--B--B--
    H---H---H---H---H---H---
    (the triplet paradiddle with high-hat)