in reply to Windows file read
To attempt to correct for this, I set the $/ variable to "\x0D\x0A". While processing the files, I then did a quick s/\x0A/ /g to "fix" the data. When tested in Linux, this worked perfectly. Unfortunately, this program must run in Windows.
That will work in Windows if (and only if) you binmode IN first. For example:
local $/ = "\x0D\x0A"; open(local *IN, '<', $filename) or die("Unable to open input file $filename: $!\n"); binmode(IN); while (<IN>) { chomp; s/\x0A/ /g; ... }
Without binmode, occurances of "\x0D\x0A" are converted to "\x0A" before Perl looks for the line ending.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Windows file read
by thedoe (Monk) on May 01, 2006 at 16:54 UTC | |
by ikegami (Patriarch) on May 01, 2006 at 17:15 UTC | |
by thedoe (Monk) on May 01, 2006 at 19:02 UTC | |
|
Re^2: Windows file read
by thedoe (Monk) on May 01, 2006 at 16:22 UTC | |
by ikegami (Patriarch) on May 01, 2006 at 16:27 UTC |