#!/usr/bin/perl -w use File::Find; use strict; my $dir = '/path/to/dir/'; my $oldestfile = 0; my $filename = "No BOT REPORT: ERROR"; finddepth(\&oldfile, $dir); print "oldest file = " , $filename,$/; sub oldfile { return unless (/BOT/); my $mtime = -M $_; if ($mtime > $oldestfile) { $filename = $File::Find::name; $oldestfile = $mtime; } }