Something like this perhaps?
... use List::Util qw{ max }; ... my %filesByAge = map { ( stat $_ )[ 9 ], $_ } glob q{*.rtf}; my $mostRecent = $filesByAge{ max keys %filesByAge }; ...
It might not pick the particular file you want if you have a lot of RTFs created at exactly the same time but that sounds unlikely.
I hope this is helpful.
Cheers,
JohnGG
In reply to Re: How to find most recent file and use it?
by johngg
in thread How to find most recent file and use it?
by luxlunae
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |