that is not so easy, because File::Find seems to rely on global variables or closures for returning values. One way might be:
Haven't run this code, but hope that it will work.use File::Find (); # no namespace pollution my @startDirectories = ....; my @foundFiles = &FindFiles(@startDirectories); sub FindFiles { my @rootdirs = @_; my @foundFiles = (); File::Find::find sub { if (-f $File::Find::name){ # just files push (@foundFiles, $File::Find::name); } }, @rootdirs; return (@foundFiles); } # FindFiles
Best regards,
perl -le "s==*F=e=>y~\*martinF~stronat~=>s~[^\w]~~g=>chop,print"
In reply to Re: Returning array of file names form find using local variables?
by strat
in thread Returning array of file names form find using local variables?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |