Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: using File::Find for reading files in order

by ysth (Canon)
on Feb 04, 2009 at 06:50 UTC ( #741196=note: print w/replies, xml ) Need Help??


in reply to using File::Find for reading files in order

Use preprocess to tell find what order to process each directory in (untested):
find( { preprocess => sub { sort { $a <=> $b || $a cmp $b } @_ }, wanted => sub { next if /^\.+$/...} }, $dir );

Replies are listed 'Best First'.
Re^2: using File::Find for reading files in order
by grinder (Bishop) on Feb 04, 2009 at 07:27 UTC

    Either that, or if there are many files that will be skipped by the regexp, sort the results just before returning them.

    return sort {$a <=> $b} @messages;

    • another intruder with the mooring in the heart of the Perl

Re^2: using File::Find for reading files in order
by Ashes.cfg (Initiate) on Feb 04, 2009 at 06:57 UTC
    Tht worked wonders.. Thanks a lot ysth. I think I would be more on perlmonks in coming months, since I might have to script a lot in coming weeks

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://741196]
help
Chatterbox?
[Lady_Aleena]: Corion, I could give the password to the gods to hold onto just in case.
[Discipulus]: Justin Case god can always get your pwd LA ;=) they all see, they all ear, they all know ;=)
[hippo]: It may be too far down the tree for some folks to bother with, but IMHO, Re^32: global var is probably node of the day already. (++)
[Lady_Aleena]: Discipulus, print working directory?

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











    Results (471 votes). Check out past polls.