On Wed, Jun 05, 2002 at 03:12:09PM -0700, James Kelty wrote:
> I am using the File::Find module from Cpan to travers some filesystems to,
> well, find a file.
> Here is my small snippet of code. Basically what is happening is that the
> sub is returning a 0 instead of the file name. What am I doing wrong?

You're expecting the returned value from your wanted subroutine to be
returned by find().  The return value of the wanted subroutine is ignored. 
Furthermore, find() doesn't return anything meaningful.

If you want a list of the found files your wanted subroutine is going to
have to append them to some array.  If you want to act on a given filename,
put the code that does the action in the wanted subroutine.

 
>        my $newConf = File::Find::find({wanted => \&wanted}, '/');
[snip]
> sub wanted {
>     /^base\\.conf\z/s &&
>     return("$name");
> }


Michael
--
Administrator                      www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to