Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
my @files = find(\&some_selection_function, $dir);
--hmmm. Seems that approach won't work because find ignores the return value of the function it calls. The only way (that I know of) to push values onto @files is to have a line like this in some_selection_function:
push @files, $_;
The only problem with that is, @files needs to be a global variable for this to work (I think), and it's not terribly clear from the line that calls find that I'm altering @files.
Anybody know of a way around this? I.e., a simple way to collect all the files that find finds?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: File::Find without global variables?
by diotalevi (Canon) on Aug 24, 2005 at 23:31 UTC | |
|
Re: File::Find without global variables?
by itub (Priest) on Aug 24, 2005 at 23:31 UTC | |
by merlyn (Sage) on Aug 25, 2005 at 00:13 UTC | |
|
Re: File::Find without global variables?
by osunderdog (Deacon) on Aug 25, 2005 at 01:41 UTC | |
|
Re: File::Find without global variables?
by Anonymous Monk on Aug 25, 2005 at 02:58 UTC |