Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Something like File::Find with sorting

by Kenosis (Priest)
on Feb 16, 2013 at 21:43 UTC ( #1019077=note: print w/ replies, xml ) Need Help??


in reply to Something like File::Find with sorting

File::Find::Rule provides a nice front end for File::Find:

use strict; use warnings; use File::Find::Rule; my $dir = "."; my @files = File::Find::Rule->file()->in($dir); print "$_\n" for sort { lc $a cmp lc $b } @files;

Partial output:

.project 10B.xml 10b.xml 1354903584-3827.xlsx 5a.xml 67.xml 6adh.pdb arrays.pl atom.pdb Bio_SeqIO.pl ...

You may also be interested in using Sort::Naturally for a lexical sort:

use strict; use warnings; use File::Find::Rule; use Sort::Naturally; my $dir = "."; my @files = File::Find::Rule->file()->in( $dir ); print "$_\n" for nsort @files;

Partial output

5a.xml 6adh.pdb 10b.xml 10B.xml 67.xml 1354903584-3827.xlsx arrays.pl atom.pdb Bio_SeqIO.pl Book1.xls


Comment on Re: Something like File::Find with sorting
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (14)
As of 2015-07-02 12:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (36 votes), past polls