Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Sort directories by date

by RichardK (Parson)
on Sep 28, 2015 at 18:35 UTC ( [id://1143276]=note: print w/replies, xml ) Need Help??


in reply to Sort directories by date

It would have been much easier if you'd created the directory names as 'YYYYMMDD' then they would have sorted naturally with little effort.

BTW, opendir/readdir are too low level and always a pain to use unless you really have to. You could try File::Find::Rule instead

use v5.20; use warnings; use File::Find::Rule; my @dirs = File::Find::Rule->directory()->maxdepth(1)->in('.'); say $_ for @dirs;

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2024-04-25 20:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found