Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Sort directories by date

by RichardK (Parson)
on Sep 28, 2015 at 18:35 UTC ( #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
Node Status?
node history
Node Type: note [id://1143276]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (3)
As of 2020-05-27 03:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If programming languages were movie genres, Perl would be:















    Results (152 votes). Check out past polls.

    Notices?