Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re^2: How to print Unix newlines in Strawberry Perl on Windows

by BrowserUk (Pope)
on Feb 20, 2013 at 12:32 UTC ( #1019774=note: print w/replies, xml ) Need Help??

in reply to Re: How to print Unix newlines in Strawberry Perl on Windows
in thread How to print Unix newlines in Strawberry Perl on Windows

In addition to Athanasius' caveats, realise that when you write "\n" to a text file, the OS will add the "\r" for you.

Thus your advice to use local $/="\r\n"; will result in "\r\r\n" being written if the file is in text mode.

In order to avoid that addition, you must binmode the file. Or remove the :crlf layer from the perlIO stack.

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1019774]
[Corion]: hippo: At least for the German translation, the wordplay is translated as well
[Discipulus]: always! but if i can ask choroba why you always use the inverted (to me) form 1 == $.?
[choroba]: To avoid accidental overwriting of the variable in if ($x = 3)
[karlgoethebier]: Corion: Auch in hessisch? Mer wasses net.
[Corion]: Hmm - I'm not sure, I haven't read the mundart/slang translations ;)
[Eily]: $F[1] =~ s/^0//r could be written as (0+$F[1]). It's less explicit though
[Discipulus]: ah! seems wise choroba, you play safe

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