use of File::Find

2003-11-06 Thread West, William M

find (\transfer, $path);

sub transfer {
my ($newpath, $oldstring, $newstring) = @_;
otherstuff ($oldstring, $newstring);

#   etc...


}


now- how do i pass parameters to transfer() when it's called 
with find??

i want the recursive fileprocessing to change file contents and
put the changed file in a mirrored directory structure-  i am
doing well enough making the program, but the documentation
had been hard to work with with regard to File::Find...

don't worry- i'm looking at perldoc File::Find too... :)

thanks all,

willy

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: use of File::Find

2003-11-06 Thread Bob Showalter
West, William M wrote:
 find (\transfer, $path);
 
 sub transfer {
   my ($newpath, $oldstring, $newstring) = @_;
   otherstuff ($oldstring, $newstring);
 
 # etc...
 
 
 }
 
 
 now- how do i pass parameters to transfer() when it's called with
 find?? 
 
 i want the recursive fileprocessing to change file contents and
 put the changed file in a mirrored directory structure-  i am
 doing well enough making the program, but the documentation
 had been hard to work with with regard to File::Find...
 
 don't worry- i'm looking at perldoc File::Find too... :)

Good, then you'll see that $_ has file file name, and $File::Find::dir has
the directory name. As for $oldstring and $newstring, you can either put
them in global variables, or do something like:

   find( sub { transfer($oldstring, $newstring) }, $path);

That arranges to pass $oldstring and $newstring to each invocation of
transfer.

HTH

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]