>>
>>>
>>> open(MYINPUTFILE ,"/net/fallsroot/export/d100/m4/input_file");
>>> open(MYOUTFILE, ">  output_file");
>>
>>
>> it is recommended to use a three argument filehandle
>
>
> "three argument filehandle"?

What I meant to imply was: "3-argument version of open"

>
>
>> open my $INPUTFILE, '<',$input_file or die "ERROR opening $input_file:
>> $!";
>> open my $OUTFILE, '>',$output_file or die "ERROR opening $output_file:
>> $!";
>>
>>>
>>> foreach $line (<MYINPUTFILE>){
>>
>>
>> use a while loop to read one line at a time
>> while ( my $line = $INPUTFILE ) {
>>     chomp $line;
>>
>>>
>>>    chomp($line);                    # remove the newline from $line.
>>>                                     # do line-by-line processing.
>>>    my @column1 = split("/\\/",$line);
>>
>> I'm not sure what you are trying to do here. Split will split on white
>> space by default
>>
>>>    print MYOUTFILE $column1[5] ,"\t" ;
>>
>> you are trying to print the fifth element in the array @column1
>
>
> Array indexes start at 0 so that is the sixth element.

You are correct. This was a careless response on my part.

>
>
>
>>>    my @column2 = split("=",$line);
>>
>> now it looks like you are wanting to split $line again based on "="
>> this would require you to reread the input file or create a better
>
>
> Why would you need to reread the input file?

How would you handle this?
The OP didn't provide the input data.

>

Chris

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to