#!/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";