use PerlIO::eol; #... open (FILE, "mypdf.pdf") or die("Can't open mypdf.pdf"); binmode FILE, ":raw:eol(LF)";