Hi
I have the following code

use strict;
use File::Find;
my @vsbe;
my $top='P:\PT-6\PT-60\PT-603\Shared\Data Store\Files Dump Folder';
my $max_depth=9;
my $cnt1=0;

find({wanted=>\&wanted1,preprocess=>\&preprocess1},$top) ;

sub wanted1 {

if ($cnt1 <=1000){
my $file = $File::Find::name;
if (grep {/vsb$/} $file){
push @vsbe, $file if $cnt1 <=1000 ;
$cnt1++;
print $cnt1,"\n" ;
}
else {return}

return if $cnt1 >=1000
}
return

}
sub preprocess1 {
    my $depth = $File::Find::dir =~ tr[\\][];
#print 'depth',"\t",$depth,"\t",$File::Find::dir,"\n";
return  @_ if $depth < $max_depth;
    return grep { not -d } @_ if $depth == $max_depth;
    return;
}

Unfortunately the wanted function never returns, it (at best) stays stuck
on print the last value of $cnt1 (1000)

Any ideas what is happening here

Reply via email to