http://www.perlmonks.org?node_id=348809


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)

Replies are listed 'Best First'.
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