I think you are looking for chomp .. From the perlfunc docs relating to chomp.. "It's often used to remove the newline from the end of an input record ..." Update: Here is a Tutorial about Basic Input and Output which might help.
-----
Of all the things I've lost in my life, its my mind I miss the most.
| [reply] |
If you wanna delve more into the subject, read the material AcidHawk gave you. But just for the matter, to erase the linebreak use chop($data = <>); (You can also use chomp instead. chomp erases the last character only if it's a newline. chop erases the last character no matter what.
-------------------------
Live fat, die young | [reply] [d/l] [select] |
chomp erases the last character only if it's a newline
Kind of but not really.
'perldoc -f chomp' says
This safer version of "chop" removes any trailing string that
corresponds to the current value of $/ ...
Sure $/ is "\n" by default, but that's besides the point.
Also, it's best to make a link to the documentation like chomp or chomp (perldoc:perlfunc:chomp|chomp] or [perldoc://chomp])
| [reply] [d/l] |
Well to be quite honest I got this sentence ("chomp erases the last...") from the Camel book. It's not a direct quote, that's just what I remembered. I would have looked it up again if I haven't returned the book to my university library last week.
And about the documentation link, I'll do that from now on.
-------------------------
Live fat, die young
| [reply] |