S
shaneal
I want to be able to print just an "LF" to a file.
First, to clear up any ambiguity, I'm going to call the ASCII
character with a hex code of 0A and a decimal code of 10 an "LF". I'm
also going to call the ASCII character with a hex code of 0D and a
decimal code of 15 a "CR".
As a simple test case:
open TEST, ">", "test.data";
select TEST;
print "A" . chr(hex("0A")) . "B" . "\n" . "C" . "\r" . "D";
close TEST;
Logically, when I look at the test.data file with a hex editor I'd
expect just a "LF" between the A and B, but instead there are is a
"CR" followed by an "LF."
Here is what a hex editor shows is in "test.data" (first line is hex,
second line are chars):
41 0D 0A 42 0D 0A 43 0D 44
A CR LF B CR LF C CR D
I was expecting only a "LF" (i.e., 0A) between the "A" (41) and
"B" (42) ...
If it helps this is Perl 5.8.8 (ActiveState Perl Build 820) on Windows
XP.
Thanks for any advice you may be able to give me.
First, to clear up any ambiguity, I'm going to call the ASCII
character with a hex code of 0A and a decimal code of 10 an "LF". I'm
also going to call the ASCII character with a hex code of 0D and a
decimal code of 15 a "CR".
As a simple test case:
open TEST, ">", "test.data";
select TEST;
print "A" . chr(hex("0A")) . "B" . "\n" . "C" . "\r" . "D";
close TEST;
Logically, when I look at the test.data file with a hex editor I'd
expect just a "LF" between the A and B, but instead there are is a
"CR" followed by an "LF."
Here is what a hex editor shows is in "test.data" (first line is hex,
second line are chars):
41 0D 0A 42 0D 0A 43 0D 44
A CR LF B CR LF C CR D
I was expecting only a "LF" (i.e., 0A) between the "A" (41) and
"B" (42) ...
If it helps this is Perl 5.8.8 (ActiveState Perl Build 820) on Windows
XP.
Thanks for any advice you may be able to give me.