in reply to Re: File:find tutorial/introduction
in thread File:find tutorial/introduction
I wouldn't callbut it has the advantage of a very simple callback.
simpler (or more complex) thanmy @found; find(sub { push @found, $File::Find::name; }, @directories); for (@found) { next if !check($_); ... }
my @found; find(sub { push @found, $File::Find::name if check($File::Find::name); + }, @directories); for (@found) { ... }
The disadvantage of the former approach is that you only have access to the fully qualified name without doing extra work. If you think that's not an issue, you might as well use cleaner File::Find::Rule.
Update: Added "not" in "If you think that's not an issue". Oops!
|
|---|