in reply to finding different linebreaks with <>

Unix (and any similar system) thinks lines end with \n. Apple thinks they end with \r. DOS couldn't decide, so it went with \r\n. Under Unix-like systems, the \r often shows up as '^M'.

Perl will change what it thinks the line ending is based on what system you're running on. You can override this by setting $/ (input record seperator) to whatever you want the newline to be (even to something that isn't a newline at all, like 'FOOBAR'). Just set local $/ = "\r"; before you read the data in and it should work.

There are also conversion programs around that will change the line endings used on one system to another (look around for 'dos2unix', 'unix2mac', etc.)

----
: () { :|:& };:

Note: All code is untested, unless otherwise stated

Replies are listed 'Best First'.
Re: Re: finding different linebreaks with <>
by Anonymous Monk on Apr 09, 2004 at 04:13 UTC
    Under Unix-like systems, the \r often shows up as '^M'
    Correction, under Unix-like text editors like vi, emacs, pico, nano ... although most can be configured to not care what the "line endings" are

      That's why I said "often shows up as", not "always show sup as".

      ----
      : () { :|:& };:

      Note: All code is untested, unless otherwise stated