in reply to perl find module

File::Find is the usual anwer to your question, but as its interface is rather arcane, File::Find::Rule is more easy to use.

The documentation lists many examples which will directly apply to your question.

Try it and if the solution still eludes you, let us know what you have tried and we will help you further.

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Replies are listed 'Best First'.
Re^2: perl find module
by moritz (Cardinal) on Oct 27, 2009 at 12:09 UTC
    but as its interface is rather arcane

    Let me respectfully disagree with that - the interface is flexible, well documented - and low-level. It is by no means arcane.

    The only obscure thing about File::Find is, IMHO, the name. It's not primarily a module to find files -- it's an iterator over files and directories (which you can use to find files, but also for various other things).

      I agree the interface is flexible, well documented and low-level, but the use of call-backs is something which is not immediately easy to understand, especially not for someone who is rather new to Perl and/or this type of programming. Hence, I call it "arcane" in the meaning of "obscure". I have to look-up the docs every time I want to use File::Find, there are too many "global" variables which contain all kinds of information some of which are to be read-only, others act as flags, ...

      File::Find::Rulen as a wrapper around File::Findn brings its interface nicely within the more familiar procedural or OO-environment.

      CountZero

      A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

      It's usage isn't arcane if closures are used, but they aren't used in any example in the documentation. They aren't mentioned at all!