in reply to How to find most recent file and use it?

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

Replies are listed 'Best First'.
Re^2: How to find most recent file and use it?
by luxlunae (Novice) on May 25, 2012 at 15:10 UTC
    That did work, using
    open INPUT, "<$mostrecent"; after the code that you supplied!