Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
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.


Comment on RE: CHOMP VS. CHOP
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
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 perusing the Monastery: (18)
As of 2015-07-02 13:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (38 votes), past polls