Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
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?
[1nickt]: Morning monks, howzit?
[ambrus]: AAAAAAARGH!
[ambrus]: something must be wrong here
[ambrus]: oh I see. I'm stupid
[marto]: hi 1nickt!
[ambrus]: The file I'm reading is already filtered, which is why I found only one kind of entry.
[1nickt]: Sorry to upset you brother Ambrus ...
[1nickt]: Ah not me, good!

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (7)
As of 2018-01-23 13:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How did you see in the new year?










    Results (246 votes). Check out past polls.

    Notices?