Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: How to find most recent file and use it?

by johngg (Abbot)
on May 25, 2012 at 14:54 UTC ( #972452=note: print w/ replies, xml ) Need Help??


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


Comment on Re: How to find most recent file and use it?
Download Code
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!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://972452]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (15)
As of 2014-08-27 12:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (238 votes), past polls