Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Finding oldest file in directory

by Roy Johnson (Monsignor)
on Oct 18, 2004 at 19:12 UTC ( [id://400283]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my $oldest;
    my $oldtime = 0;
    ...
        ($oldest, $oldtime) = ($_, $thistime);
      } 
    }
    
  2. or download this
    use List::Util 'reduce';
    my $file = (reduce {$a->[0] < $b->[0] ? $a : $b}
                       map {[(stat)[10],$_]}
                       glob '*.pl'
               )->[1];
    
  3. or download this
    my $file = reduce {(stat $a)[10] < (stat $b)[10] ? $a : $b}
                      glob '*.pl';
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2024-04-18 22:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found