Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^2: line breaks on Win32::Clipboard

by radiantmatrix (Parson)
on Sep 15, 2005 at 20:16 UTC ( [id://492414]=note: print w/replies, xml ) Need Help??


in reply to Re: line breaks on Win32::Clipboard
in thread line breaks on Win32::Clipboard

It works, but it may not be portable between the various Win32 versions of Perl. "\n" can mean different things to differing perls. Best to use the literals (chars 0x0D and 0xOA are CR and LF, respectively). Also, you'll want not to replace line endings that are already correct, because you'd end up with a "\r\r\n" (bad).

$SomeVar =~ s{(?<!\x0D)\x0A}{\x0D\x0A}g;

Updates:

  • 2005-09.Sep-15 : Clarified term 'portable'

<-radiant.matrix->
Larry Wall is Yoda: there is no try{} (ok, except in Perl6; way to ruin a joke, Larry! ;P)
The Code that can be seen is not the true Code
"In any sufficiently large group of people, most are idiots" - Kaa's Law

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2024-04-19 17:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found