in reply to extra spaces before \r\n

If you can copy, paste and read English, have a look at perlfaq4, How do I strip blank space from the beginning/end of a string?

++ vs lbh qrpbqrq guvf hfvat n ge va Crey :)
Nabgure bar vs lbh qvq fb jvgubhg ernqvat n znahny svefg.
-- vs lbh hfrq OFQ pnrfne ;)
    - Whreq