[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl-Modules] File::find problem



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;
            unless (-d $file) {
                open (IN, $file) or warn "Can't open $file";
                while (<IN>) {
                    while ( s/([^\s]+@[^\s]+)// ) {print "$file $1 \n"}
                }
            close IN;
            }
    }, @ARGV);

wich works if I drop a set of files on the saved droplet, but I get the following
error if I drop a folder on it:

    # Use of uninitialized value.
    File 'Workshop HD:etc:MacPerl Ÿ:lib:File:Find.pm'; Line 151
    # Use of uninitialized value.
    File 'Workshop HD:etc:MacPerl Ÿ:lib:File:Find.pm'; Line 158

The -d test doesn't seem to be working for directories. Is it confusing the way
File::Find does its traversal of the directories? The -d test works below works.
    
    #!perl -w
    use File::Find;
    find(sub {
        my $file = $File::Find::name;
        print $file, "\n" if -d;
    }, @ARGV);

I'd be grateful for any suggestions or help.

Rory

--
		  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