colint has asked for the wisdom of the Perl Monks concerning the following question:
[predb24:~/tests] $ cat lines.pl #!/usr/bin/perl open (TEST, ">test.txt"); print TEST "This is a test\n"; #print TEST "This is a test\n"; #print TEST "";<br/> close TEST;<br/> [predb24:~/tests] $ lines.pl [predb24:~/tests] $ od -cx test.txt 0000000 T h i s i s a t e s t \n \ +0 6854 7369 6920 2073 2061 6574 7473 000a 0000017 [predb24:~/tests] $ cat lines.pl #!/usr/bin/perl open (TEST, ">test.txt"); print TEST "This is a test\n"; print TEST "This is a test\n"; #print TEST ""; close TEST; [predb24:~/tests] $ lines.pl [predb24:~/tests] $ od -cx test.txt 0000000 T h i s i s a t e s t \n +T 6854 7369 6920 2073 2061 6574 7473 540a 0000020 h i s i s a t e s t \n 6968 2073 7369 6120 7420 7365 0a74 0000036 #!/usr/bin/perl open (TEST, ">test.txt"); print TEST "This is a test\n"; print TEST "This is a test\n"; print TEST ""; close TEST; [predb24:~/tests] $ lines.pl [predb24:~/tests] $ od -cx test.txt 0000000 T h i s i s a t e s t \n +T 6854 7369 6920 2073 2061 6574 7473 540a 0000020 h i s i s a t e s t \n 6968 2073 7369 6120 7420 7365 0a74 0000036 [predb24:~/tests] $ cat lines.pl #!/usr/bin/perl open (TEST, ">test.txt"); #print TEST "This is a test\n"; #print TEST "This is a test\n"; print TEST "\n"; close TEST; [predb24:~/tests] $ lines.pl [predb24:~/tests] $ od -cx test.txt 0000000 \n \0 000a 0000001
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Why do I sometimes get null characters after the line feed when writing to files?
by dave_the_m (Monsignor) on Dec 18, 2006 at 16:20 UTC | |
|
Re: Why do I sometimes get null characters after the line feed when writing to files?
by derby (Abbot) on Dec 18, 2006 at 16:17 UTC | |
|
Re: Why do I sometimes get null characters after the line feed when writing to files?
by graff (Chancellor) on Dec 18, 2006 at 23:44 UTC |