Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Reading in a file not recognizing lines

by Fletch (Bishop)
on May 21, 2006 at 23:19 UTC ( [id://550837]=note: print w/replies, xml ) Need Help??


in reply to Reading in a file not recognizing lines

Mac OS (well, at least older Mac OS) use(s|d) \x0d to represent end of line, so your file probably came from there or hopped through there without proper translation. You could:

  • re-fetch the file, this time telling whatever mechanism you're using to treat it as a text file (e.g. FTP in ASCII mode)
  • set $/ to \x0D
  • use split as you've done
  • use the *NIX tr utility to translate the line endings
  • use the perl -i -pe equivalent of the above to do the same

Also: see perlport for the section on "Newlines".

Replies are listed 'Best First'.
Re^2: Reading in a file not recognizing lines
by bradcathey (Prior) on May 22, 2006 at 11:24 UTC

    Fetch, thanks. Great insight: was using an old OS9 program to generate tab-delimited conversion for transport to web.

    Embarrassingly, I've never worked with $/. Thanks for the nudge.


    —Brad
    "The important work of moving the world forward does not wait to be done by perfect men." George Eliot

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://550837]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-04-23 19:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found