in reply to Re: Finding files in a directory tree from and array of file names
in thread Finding files in a directory tree from and array of file names

By "not working" I mean that nothing is being displayed by the print command.
Using use strict I get the following errors...
Global symbol "$srcfile" requires explicit package name at D:\Projects +\perl\recurse.pl line 26. Global symbol "$srcfile" requires explicit package name at D:\Projects +\perl\recurse.pl line 34. Execution of D:\Projects\perl\recurse.pl aborted due to compilation er +rors.
What exactly does this mean?

Replies are listed 'Best First'.
Re: Re: Re: Finding files in a directory tree from and array of file names
by pixel (Scribe) on Oct 15, 2001 at 15:54 UTC

    Your @sourcefiles array contains $File::Find::name for each of the found files. This is the full pathname of the file.

    Later you check these values against the filename in $_. This only contains thea actual name of the file so your match will never work.

    strict turns on a number of constraints that will make your Perl scripts better. One of the most useful is that it forces you to think about variable scoping and predeclare variables. This is most often done using my. That's the error that you're seeing.

    I didn't really expect you to just add the line without reading the documentation first :-)

    Blessed Be
    The Pixel