Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: regexp for scalar containing a mixture of LF & CRLF

by Eimi Metamorphoumai (Deacon)
on Dec 09, 2004 at 23:05 UTC ( #413713=note: print w/replies, xml ) Need Help??

in reply to regexp for scalar containing a mixture of LF & CRLF

I think what you want is
The problem with your code is that you're trying to replace a single CR with an LF, so if you have an LF alone, it's unchanged. If you start with CRLF, you end up with LFLF, which isn't what you want. What you need to look for is an LF not preceded by CR, and replace it with CRLF.

Update: It appears I spoke a little too soon, and with too much Unix-centrism. The text was fine, but I forgot that "\n" in Perl changes meaning under different platforms. What you want is


Replies are listed 'Best First'.
Re^2: regexp for scalar containing a mixture of LF & CRLF
by NateTut (Deacon) on Dec 09, 2004 at 23:59 UTC
    Thanks, but nope. See my next post for my ugly answer that finally worked.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://413713]
[james28909]: id just rename the subrouties perl what kind of data they are getting. something easy to remember too. like if get_data were returning movies titles, rename get_data to movies or movie_titles or get_movie_titles.
[james28909]: s/perl/per/

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (6)
As of 2017-05-24 04:24 GMT
Find Nodes?
    Voting Booth?