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

Re: Something like File::Find with sorting

by RichardK (Vicar)
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);

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

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2015-11-29 20:32 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (753 votes), past polls