|Just another Perl shrine|
Re: Using File::Find from a function.by vinoth.ree (Prior)
|on Mar 19, 2013 at 06:23 UTC||Need Help??|
From CPAN doc
find() does a depth-first search over the given @directories in the order they are given. For each file or directory found, it calls the &wanted subroutine.Additionally, for each directory found, it will chdir() into that directory and continue the search, invoking the &wanted function on each file or subdirectory in the directory.Update:
You can do this way.
The check_existance function takes no arguments but rather does its work through a collection of variables.
$File::Find::dir is the current directory name,
$_ is the current filename within that directory
$File::Find::name is the complete pathname to the file.
The above variables have all been localized and may be changed without affecting data outside of the check_existance function.Beginners guide to File::Find