On Wed, 27 Jul 2011 16:03:32 -0400
Tim Lewis <[email protected]> wrote:
> I found an answer that I thought I would share.
>
> I am using ActivePerl on Windows server 2003. ActivePerl translates 0A as
> CR\LF.
That's the case for most Windows Perls.
> The print statement was causing the issue. To stop this, I added
> binmode to my file handle:
>
> open(OUTPUT,">$outputFileName");
> binmode OUTPUT;
There's a lot wrong with this code:
1. You're using package-global filehandles.
2. You're using two-args open.
3. You're not checking that open succeeded.
The correct form is:
<CODE>
open my $output_fh, '>', $output_filename
or die "Cannot open '$output_filename' for writing - $!";
binmode($output_fh);
</CODE>
Regards,
Shlomi Fish
--
-----------------------------------------------------------------
Shlomi Fish http://www.shlomifish.org/
Original Riddles - http://www.shlomifish.org/puzzles/
Linux — Because Software Problems Should not Cost Money.
Please reply to list if it's a mailing list post - http://shlom.in/reply .
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/