#!/usr/bin/perl -w use File::stat; use CGI; use strict; my $cgi = new CGI; print $cgi->header; my $dirname = '/www/htdocs/reports/bot/'; my $oldestfile = 0; my $filename = "No BOT REPORT: ERROR"; opendir(DIR, $dirname) or die "can't opendir $dirname: $!"; while (my $file = readdir(DIR)) { if ($file =~ /BOT/){ my $x = stat($file)->mtime; if ( $x > $oldestfile) { $oldestfile = $x; $filename = $file; } } } print <$filename - BOT Report.
EOF closedir(DIR);