Are you performing a chomp on each line read? If not, then you will retain
the carriage return / line feed at the end of the data. And if you are
parsing the data, it could very well be stored in your variables.
Try changing :
@lines=<FileIn>;
To:
for (<FileIn>) {
push @lines, chomp($_)
}
or
push(@linesm chomp($_)) for (<FileIn>);
Try that.
-----Original Message-----
From: Jorge Palma [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 08, 2005 10:16 AM
To: [email protected]
Subject: Fw: writing file in binary mode
Sorry,
here is the part where a write to the file.
The problem is it write ok, but in text mode and not in binary mode.
Thanks
# --- open and read all text file and put it in array
open(FileIn,"$dirBase\\PSData_21.txt"), or die;
@lines=<FileIn>;
close (FileIn);
# --- open outfile in binary mode
open (FileOut, ">>$dirBase\\PSData_mwd_21");
binmode (FileOut);
...
print FileOut "$stid $rlat $rlon $tim $nlev $nflag\n" ;
...
----- Original Message -----
From: "Bowie Bailey" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Thursday, September 08, 2005 3:33 PM
Subject: RE: writing file in binary mode
> From: Jorge Palma [mailto:[EMAIL PROTECTED]
>>
>> Does anyone can tell me if is possible write a file in binary mode?
>> I'm working in windows.
>>
>> I'm using the binmode function but it does'nt work. The
>> script write the file in text mode.
>
> It's hard to say why it's not working without seeing the code.
>
> Show us the script (or at least the bit that's writing the file).
>
> Bowie
> _______________________________________________
> ActivePerl mailing list
> [email protected]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs