Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Re: (Buzzcutbuddha - Further Help) - File Find

by oaklander (Acolyte)
on Jan 16, 2002 at 17:39 UTC ( #139199=note: print w/replies, xml ) Need Help??


in reply to Re: (Buzzcutbuddha - Further Help) - File Find
in thread File Find

I will have to play around with what you gave me to make it work. I appreciate all of your help on this! Can you just explain what this line is doing?
find ( { wanted => \&change, no_chdir => 1}, @dirs );
Is 'wanted' a function in the find module?? What is 'no_chdir => 1' doing??? Answers to your questions about what I am using. Perl version 5.005 on Windows NT. Directories are small size and are local

Replies are listed 'Best First'.
Re: (Buzzcutbuddha - Quick Overview of File::Find Syntax) - File Find
by buzzcutbuddha (Chaplain) on Jan 16, 2002 at 18:34 UTC

    From the File::Find doc pages: The first argument to find() is either a hash reference describing the operations to be performed for each file, or a code reference.

    wanted: The value should be a code reference. This code reference is called the wanted() function below.

    no_chdir: The script does not change each directory as it recurses.

    What that basically means is if you only want to pass the code reference, you can just pass if, as you did in your first script. However, if you want to add any parameters to your call of File::Find (all of which are explained in the doc pages), you need to construct an anonymous hash:
    {wanted => \&coderef, parameter => 'value'}

    This is a common way of passing named parameters into functions.

    hth.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2023-09-27 06:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?