in reply to Mac vs. PC line breaks
# guess to set $/ to correct linebreaks # untested code. local $/ = \1000; # read first 1000 bytes local $_ = <$file>; my $newline; for my $test ("\015\012","\015","\012") { # match various newline char +s, default to unix $newline = $test; last if /$test/; } local $/ = $newline; seek $file,0,0; # rewind to start of file
You should probably also use Text::xSV or Text::CSV_XS instead of trying to parse it yourself.
update: qw() doesn't interpolate \015, so I fixed that
update2: ikegami pointed out a typo. I fixed it.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Mac vs. PC line breaks
by ikegami (Patriarch) on Aug 05, 2005 at 17:24 UTC | |
by Joost (Canon) on Aug 05, 2005 at 18:19 UTC |