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

Re: Something like File::Find with sorting

by RichardK (Parson)
on Feb 16, 2013 at 17:46 UTC ( #1019052=note: print w/replies, xml ) Need Help??


in reply to Something like File::Find with sorting

Why not put your file names into a list rather than printing them out, and then sorting the list ?

So, something like this , untested :)

use strict; use File::Find; my @files; my $dir = "/some/dir/in/linux"; File::Find::find (\&search, $dir); sub search { if (-f $_) { push @files,$_; } } for (sort { your sort criteria here} @files) { say $_; }

BTW I find it easier to use File::Find::Rule

my @files = File::Find::Rule->files()->in($dir);

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (12)
As of 2016-10-01 19:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?






    Results (6 votes). Check out past polls.