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

Re: Multiple regex against files with speed

by jeffa (Chancellor)
on Apr 28, 2004 at 13:11 UTC ( #348809=note: print w/ replies, xml ) Need Help??


in reply to Multiple regex against files with speed

How about not reinventing a perfectly round wheel and adding File::Basename to your problem? Or even better --- have you seen File::Find::Rule yet?

my @files = File::Find::Rule ->file() ->name( '*.doc', '*.xls', '*.ppt' ) ->in( @DIRS ) ;

UPDATE:
crabbdean just pointed out File::Find memory leak to me.

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)


Comment on Re: Multiple regex against files with speed
Download Code
Re: Re: Multiple regex against files with speed
by crabbdean (Pilgrim) on Apr 28, 2004 at 13:35 UTC
    The module I've build already breaks the full file name into 4 pieces - a relative path, base directory, fullfile name and filename. So I've got that bit nicely. The problem with the "File::Find::Rule" is that it utilises the "File::Find" which I'm trying to avoid. Unfortunately considering "File::Find" is a core Perl module it means re-inventing the wheel. Ho hum! Although I do like the interface used on some of the "File::Find::Rule" methods. I have a read through his code.

    Dean
    The Funkster of Mirth
    Programming these days takes more than a lone avenger with a compiler. - sam
    RFC1149: A Standard for the Transmission of IP Datagrams on Avian Carriers

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2014-09-16 01:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (155 votes), past polls