Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: the chomp does not seem to work

by hipowls (Curate)
on Mar 11, 2008 at 10:11 UTC ( [id://673444]=note: print w/replies, xml ) Need Help??


in reply to the chomp does not seem to work

I can reproduce the behaviour on my linux box using windows format text files, that is lines end with "\r\n". It works as expected when the line endings are just "\n" on linux

Replies are listed 'Best First'.
Re^2: the chomp does not seem to work
by Skeeve (Parson) on Mar 11, 2008 at 12:35 UTC

    That's why I usually use $line=~tr/\015\012//d.

    This removes any CR and LF from $line. It works fine as long as you don't care for empty lines.


    s$$([},&%#}/&/]+}%&{})*;#$&&s&&$^X.($'^"%]=\&(|?*{%
    +.+=%;.#_}\&"^"-+%*).}%:##%}={~=~:.")&e&&s""`$''`"e

Log In?
Username:
Password:

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

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

    No recent polls found