Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Something like File::Find with sorting

by RichardK (Priest)
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?
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 studying the Monastery: (9)
As of 2014-09-30 10:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (363 votes), past polls