in reply to How to remove all new line ?

You look like you've got it figured out except for reading the entire file, not one line at a time. To read the entire file, you can set $/ to undef or use File::Slurp.
use File::Slurp "read_file"; my $data = read_file($tmpfile); $data =~ tr/\r\n//d;