Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
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 musing on the Monastery: (7)
As of 2014-10-02 12:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    What is your favourite meta-syntactic variable name?














    Results (56 votes), past polls