J
John
I want to read a file line-by line and write it line by line to another file.
Regarless of environment I want newline start with DOS's \x0d\x0a
Here's the code snippet:
$ii=open(MYHAN,"<file01.htm");
open(MYHAN2,">>receive.htm");
binmode(MYHAN);
binmode(MYHAN2);
while ($line=<MYHAN>)
{
chomp($line);
$line=~s/\x0d//g; # probably unnecessary
$line=~s/\x0a//g;
print MYHAN2 $rivi."testing\x0d\x0a";
}
close MYHAN;
closeMYHAN2;
The problem is that I get in "receive.txt" I get ending
"balhblahtesting[CR][CR][LF]" where [CR] mean carriage return and [LF] line feed.
Why is this happening? I've chomped and ~s'd the $line. I've also binmoded both
file handles for good measure.
Regarless of environment I want newline start with DOS's \x0d\x0a
Here's the code snippet:
$ii=open(MYHAN,"<file01.htm");
open(MYHAN2,">>receive.htm");
binmode(MYHAN);
binmode(MYHAN2);
while ($line=<MYHAN>)
{
chomp($line);
$line=~s/\x0d//g; # probably unnecessary
$line=~s/\x0a//g;
print MYHAN2 $rivi."testing\x0d\x0a";
}
close MYHAN;
closeMYHAN2;
The problem is that I get in "receive.txt" I get ending
"balhblahtesting[CR][CR][LF]" where [CR] mean carriage return and [LF] line feed.
Why is this happening? I've chomped and ~s'd the $line. I've also binmoded both
file handles for good measure.