$your_variable_containing_newlines =~ tr/\n\r//d;