$lines =~ tr/\r//d; $lines =~ tr/\n//s; # or this? $lines =~ tr/\r?\n//s;