in reply to Writing a UNIX text line - the end character challenge
You need to do more debug printing.
Read a very short file with a few characters over just two lines for simplicity. print " " . ord($_) foreach split //, $linein; And do that both before and after the chomp.
Notice what's going on now?
Short.txtopen my $fh, '<', 'short.txt'; binmode $fh; my $linein = <$fh>; print " " . ord($_) foreach split //, $linein; print "\n"; chomp $linein; print " " . ord($_) foreach split //, $linein; print "\n";
Output:ab 123
97 98 13 10 97 98 13
PS: See the first line in chomp
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Writing a UNIX text line - the end character challenge
by merrymonk (Hermit) on Aug 11, 2010 at 13:39 UTC | |
by SuicideJunkie (Vicar) on Aug 11, 2010 at 13:56 UTC | |
by merrymonk (Hermit) on Aug 11, 2010 at 14:04 UTC | |
by JavaFan (Canon) on Aug 11, 2010 at 15:33 UTC |