Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re^2: String wraps after a replace operation

by aceroraptor (Initiate)
on Jan 05, 2014 at 18:31 UTC ( #1069402=note: print w/replies, xml ) Need Help??

in reply to Re: String wraps after a replace operation
in thread String wraps after a replace operation

My development environment is on cygwin, the issue was
due to my test text file containing sample data was
saved in a file Format = PC and encoding = DOS, once I
changed it to Format = UNIX and encoding = ANSI my code worked.

  • Comment on Re^2: String wraps after a replace operation

Replies are listed 'Best First'.
Re^3: String wraps after a replace operation
by Jim (Curate) on Jan 06, 2014 at 00:30 UTC

    This is a classic:  CR-LF versus LF newline differences in text files between operating systems (DOS/Windows versus Unix/Linux/OS X).

    What text editor did you use to save the file using those formats and character encoding names? I ask this because those names are bogus and confusing, especially the character encoding names. There's no such thing as an encoding named "DOS", and the name "ANSI" is an historic misnomer that is more properly "Windows-1252" or "Code Page 1252" or "CP1252". I suspect the encoding name "DOS" is intended to mean "Code Page 437" or "CP437". But who knows?

    You may need to use a better text editor.

    Unless you're doing something extraordinary to thwart its default behavior (setting the mode of the I/O layer to :raw, for example), Perl should just be doing the right thing with the line terminators in your file. In other words, in general, Perl handles both CR-LF and LF logical newlines correctly and transparently. What version and distro of Perl are you using? ActiveState Perl? Strawberry Perl? Or the Perl that comes with Cygwin?


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1069402]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2018-04-23 05:15 GMT
Find Nodes?
    Voting Booth?