in reply to Re: Re: file::find question
in thread file::find question

You know, I could probably help you better if you'd say what it is you're trying to do. If you're just using File::Find to find a list of filenames, and then doing something with those names later, you could write a little wrapper around find like this:
sub find_files(&@) { my( $criteria_cr, @dirs ) = @_; my @found; find( sub { $criteria_cr->( $File::Find::name ) and push @found, $File::Find::name; }, @dirs ); @found } # then you could call it like this: my @html_files = find_files { /\.html$/ } '.'; my @abc_subdirs = find_files { -d $_[0] } 'a', 'b', 'c';
Don't be afraid to use 'my' variables for purposes such as this. It is the very natural, perlish thing to do.

jdporter
...porque es dificil estar guapo y blanco.