in reply to Return newest file

You can access items in an array with negative indices:

my @list = `dir *.log \/B \/OD`; my $newest = $list[-1]; print "$newest\n";

Some people dislike shelling out, though. You could use readdir, sort, and the -X filetest operators to check timestamps. I think it'd look something like this:

my @files = sort { -M $a <=> -M $b } <*.log>; my $newest = $files[-1]; print "$newest\n";

That's untested, though, since it's late and I don't run Windows.