On Mar 22, 2007, at 3:42 PM, Matt Herzog wrote:

> I can't seem to understand how to use a variable with the find 
> (\&wanted
> syntax from File::Find. I suppose I can substitute "wanted" with & 
> $whatever ?
> So far it does not work.

The word "wanted" is why I loathe File::Find so much, because it is  
deceiving.  It should really be

find( \&function_that_gets_called_once_for_each_file, $targetdir );

sub function_that_gets_called_once_for_each_file {
     print $File::Find::name, "\n";
}

That should be a bit clearer.


I would suggest you abandon File::Find entirely and use File::Next,  
so you can do this:

my $files = File::Next::files( $targetdir );
while ( my $filename = $files->() ) {
     print $filename, "\n";
}

Much clearer, yes?

xoa


--
Andy Lester => [EMAIL PROTECTED] => www.petdance.com => AIM:petdance




 
_______________________________________________
Boston-pm mailing list
Boston-pm@mail.pm.org
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to