in reply to still confused with CGI and carriage returns carriage returns

You also may be experiencing ^M characters from Windows clients; so really you should use s/\n|\r/ /g;