in reply to File::FInd subfolders

File::Find changes the working directory as it traverses the directory tree and the $File::Find::name contains the complete path from the starting directory. You want to use $_ instead. That is just the filename, without path.

HTH, Jenda
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
   -- Rick Osborne

Edit by castaway: Closed small tag in signature

Replies are listed 'Best First'.
Re: Re: File::FInd subfolders
by Anonymous Monk on May 24, 2004 at 16:44 UTC
    sorry, do u mean that it should read $_File....etc?

      No. What I mean is that instead of $File::Find::name you should use $_:

      my $folder = '//..'; find (\&process, $folder); sub process { if ( $_ =~ /\learn$/ ) { open (FILE, '<', $_ ) or die "Cannot open file: $!"; while ( $line = <FILE> ) { $/= "# input for"; $line =~ s/.....; push(@outLines, $line ); } print to outputfile... } }

      Jenda
      Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
         -- Rick Osborne

      Edit by castaway: Closed small tag in signature