Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

RE: CHOMP VS. CHOP

by pschoonveld (Pilgrim)
on Aug 02, 2000 at 15:16 UTC ( #25701=note: print w/replies, xml ) Need Help??


in reply to CHOMP VS. CHOP

chomp, by definition, removes the contents of $/ from the end of a string. Perhaps, if you know that your client will be windows, you should set $/ to \n\r (or is it \r\n, I can never remember). What it comes down to is that windows uses a \r\n combination as it's end of lines, and *nix appropriately uses \n. The sketchy, but easy way to handle this is to do a regex replacement (s/to replace/replacement/). But, that could cripple you should you want multi line data to stick around. My preference would be to remove any instance of \r (your ^M) and chomp when necesary.

Replies are listed 'Best First'.
RE: RE: CHOMP VS. CHOP
by amelinda (Friar) on Oct 11, 2000 at 22:33 UTC
    It's \r\n, fo' sho'. Think about it - CR then LF makes up the mystical CRLF in DOSland, and you only need LF in UNIXland.

    Aren't mnemonics great?

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2023-03-20 16:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which type of climate do you prefer to live in?






    Results (59 votes). Check out past polls.

    Notices?