On 31/10/99 at 11:55 AM, schinder@pobox.com (Paul Schinder) wrote: > At 11:55 PM +0100 10/30/99, Rory C-L wrote: > >I'm trying to open a set of files in various directories and print > >out anything that looks like an email address after the full > >address of the file. > > > >I've been trying: > > > > #!perl -w use File::Find; find(sub { my $file = Find::File::name; > > This should be $File::Find::name. A simple test shows what's > happening: > > my $file = Find::File::name; print "$file"; print " is not a > directory" unless -d $file; print "\n"; > Paul Thanks very much for your message After correcting my typo I'm still getting undef. error messages when I drop a directory on the droplet. Files are parsed ok. #!perl -w use File::Find; find(sub { my $file = $File::Find::name; return if (-d $_); open (IN, $file) or warn "Can't open $file"; while (<IN>) { while ( s/([^\s]+@[^\s]+)// ) {print "$file $1 \n"} } close IN; }, @ARGV); produces the same result as the code I posted originally Although, as I wrote, the code below works fine. The open function seems to cause a problem. > > > > #!perl -w use File::Find; find(sub { my $file = $File::Find::name; > > print $file, "\n" if -d; > > }, @ARGV); once again, > >I'd be grateful for any suggestions or help. ! Best wishes Rory p.s. Just been trying #!perl -w use File::Find; find(sub { my $file = $File::Find::name; if (-d $file) { $file = $file . ':'; print $file, "\n" } else { open (IN, $file) or warn "Can't open $file"; while (<IN>) { while ( s/([^\s]+@[^\s]+)// ) {print "$file $1 \n"} } close IN; } }, @ARGV); Test case with folder structure outer: inner: t2 t1 (t1 is in folder outer) I get the correct output until I hit the end of the results for file t2, then a set of errors in File::Find is recorded: HD:Desktop Folder:outer: HD:Desktop Folder:outer:inner: HD:Desktop Folder:outer:inner:t2 awilk@ucl.edu HD:Desktop Folder:outer:inner:t2 gal@mcm.com HD:Desktop Folder:outer:inner:t2 andy@a.com HD:Desktop Folder:outer:inner:t2 bcl@hop.co.uk HD:Desktop Folder:outer:inner:t2 custservice@barebones.com # Use of uninitialized value. File 'Workshop HD:Rory:Rory's applications:programming:MacPerl Ÿ:lib:File:Find.pm'; Line 151 # Use of uninitialized value. File 'Workshop HD:Rory:Rory's applications:programming:MacPerl Ÿ:lib:File:Find.pm'; Line 158 # Can't open HD:Desktop Folder:outer:inner:t2:t2. File 'HD:Desktop Folder:changer'; Line 9 The wierd stuff is on the last line, whiere Perl tries to open file HD:Desktop Folder:outer:inner:t2:t2 (found where?) -- Rory Campbell-Lange + The Campbell-Lange Workshop London ==== Want to unsubscribe from this list? ==== Send mail with body "unsubscribe" to macperl-modules-request@macperl.org