Ben Tisdall wrote:
> whilst I'm still trying to get my head round the debugger, any pointers
> as to why the script fragment below causes one or more of the following
> warnings would be most appreciated!
>
> Use of uninitialized value in numeric eq (==) at
> /Users/bentis/bin/find_dupes.pl line 12.
>
>
> #!/usr/bin/perl -w
> use strict;
> use File::Find;
> use File::Compare;
> my ($infile,$i,@allfiles,$basefile,$cmpfile,$matched) ;
> find(\&wanted, @ARGV);
> sub wanted {
> $infile = $File::Find::name;
> {
> last if (/^\~.*\.tmp/i);
> last if (/^\..*/);
> last if ((stat($infile))[7] == 0);
> last if (-d $infile);
> push (@allfiles,$infile);
> }
> }
Does that warning appear for *every* file that find() finds, or only
certain ones? It is basically saying that the stat of $infile returned
undef for the size. I'm not sure why that would ever happen, except
for a file that does not exist. But that shouldn't happen, because
$infile is set to whatever file/directory File::Find is currently
looking at. Is this happening on a dynamically changing structure,
where a file could be there one instant and gone the next? Otherwise,
add some debugging info to the wanted() subroutine, to print out the
current file. Then see if there's something "special" about that file
on your file system if it produces the warning...
Sorry I can't be of more help,
Paul Lalli
|