http://www.perlmonks.org?node_id=566734
gyasuda has asked for the wisdom of the Perl Monks concerning the following question:

I am using an AIX 5200-05 (IBM UNIX) with perl.rte 5.8.0.10.

I have a file /tmp/log/startOnline.was_20050801_0701.joblog which has a timestamp of Aug 01 2005. The last time it was accessed and modified was like over 370 days. Of course, the /tmp/log directory has many log files.

In Perl, here is part of the code:

$path = "/tmp/log"; $file = "startOnline.was_*_*.joblog"; @TODELETE = `ls -t $path/$file`; foreach $logfile (@TODELETE) { printf ("%12s %5d %5d %5d\n", $logfile, -M $logfile, -A $logfile, -C + $logfile); }

The output lists "/tmp/log/startOnline.was_DATE_TIME.joblog 0 0 0".

In Perl, I thought the "-M" file-test operator returns how long since the file has been modified, "-A" returns how long since the file has been accessed, and "-C" returns how long since the file's inode has been accessed.

If $logfile has the full path of the filename, how come the file-test operators display zeroes?

If I can get the file operators to work, I can finish my Perl script to start deleting the older log files.

Any help would be appreciated.

Gary