Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Re: Return newest file

by snax (Hermit)
on Aug 13, 2003 at 20:29 UTC ( [id://283682]=note: print w/replies, xml ) Need Help??


in reply to Re: Return newest file
in thread Return newest file

Why torture yourself to grab the last element when you can reverse the sort and grab the first? It strikes me as being semantically clearer as well:
$newest = (sort { -M $a <=> -M $b } <*.log>)[0];
Same story with the Schwartz trick.

Of course, TIMTOWTDI :)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (6)
As of 2024-04-16 09:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found