Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
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?
Ratazong takes a cookie from the platter on the sideboard.
Ratazong adds shortbread cookies to the platter on the sideboard.
[Lady_Aleena]: Hi Ratazong.
[Ratazong]: Hi Lady Aleena
Ratazong just learned about free cookies ;-)
shmem rolls a barrel of beer into the refectorium at the request of jedikaiti

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (8)
As of 2017-04-26 10:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (471 votes). Check out past polls.