On Feb 10, 2006, at 18:17, Rick Triplett wrote:
I've encountered a perplexing file-reading difficulty.
I pasted some dictionary definitions from a web page into Word and
saved them as a text file. All the odd numbered lines had terms and
their following even numbered lines had definitions. My goal was
to convert every other line ending to a tab character and paste the
result into a spreadsheet or data base, so the term-definition
pairs would be together. I couldn't do this with Word, but decided
it should be an easy task with Perl.
I use Perl 5.8.6 on a Mac with the latest OS (10.4.4). My text
editor (Bare Bones TextWrangler) told me that the line endings in
my file were \r (character 13) as I expected on a Mac.
Wrong, Perl's "\n" in OS X is eq "\012". TextWrangler is known to
save files using the old convention (and most editors make that
configurable, with the corresponding newline-nightmare). Character 13
was newline in pre-OS X, and it was eq "\n" in MacPerl.
-- fxn (<-- who one day will write an article about dealing with
newlines, when Real Life Stops)
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>