in reply to Re^6: different length of a line from linux and windows textfile? (still wrong)
in thread different length of a line from linux and windows textfile?
Maybe I'm not understanding your point, but according to my tests chomp sill strips out "\r" when using binmode on Windows.
D:\test>od -c win32.txt 0000000 l i n e o n e \r \n l i n e +t 0000020 w o \r \n 0000024 D:\test>od -c nix.txt 0000000 l i n e o n e \r \n l i n e +t 0000020 w o \r \n 0000024 D:\test>perl -wpi.bak -e "BEGIN{binmode STDIN; binmode STDOUT;} chomp +$_;" win32.txt D:\test>perl -wpi.bak -e "BEGIN{binmode STDIN; binmode STDOUT;} chomp +$_;" nix.txt D:\test>od -c win32.txt 0000000 l i n e o n e l i n e t w +o 0000020 D:\test>od -c nix.txt 0000000 l i n e o n e l i n e t w +o 0000020
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^8: different length of a line from linux and windows textfile? (STDIN)
by tye (Sage) on Mar 17, 2014 at 23:51 UTC |