in reply to Re: subset extraction from master file
in thread subset extraction from master file

this gives me an error David like it does not understand what is trying to be opened? Below is the error:

./23file.pm: open: not found ./23file.pm: open: not found ./23file.pm: open: not found ./23file.pm: syntax error at line 4: `)' unexpected
any clues? Thanks.

Here is the code I am using

open MASTER, "file3" or die "cant't open master file: $!\n"; open SUBSET, "file2" or die "can't open subset file: $!\n"; open OUT, ">outfile" or die "can't open output file: $!\n"; while ( my $sline = <SUBSET> ) { chomp $sline; my ( $subkey, $subvals ) = split /:/, $sline, 2; my ( $mkey, $mvals ); while ( my $mline = <MASTER> ) { chomp $mline; ( $mkey, $mvals ) = split /:/, $mline, 2; last if $mkey eq $subkey; } print OUT join ":", $subkey, $subvals, $mvals; } close SUBSET; close MASTER; close OUT or die "couldn't close outfile: $!\n";

Replies are listed 'Best First'.
Re: Re: Re: subset extraction from master file
by davido (Cardinal) on Nov 18, 2003 at 16:34 UTC
    Sounds like you're executing the script as though it were a shell script rather than as a Perl script. Did you add a shebang line?

    Also, see my minor update to the "print" line.


    Dave


    "If I had my life to live over again, I'd be a plumber." -- Albert Einstein