in reply to Re^4: Can't get Tie::File working
in thread Can't get Tie::File working

I guess that's some inexactness in the documentation of Tie::File. Looking at the source code, there is the following code, which sets/forces $/ to \r\n:

sub _default_recsep { my $recsep = $/; if ($^O eq 'MSWin32') { # Dos too? # Windows users expect files to be terminated with \r\n # But $/ is set to \n instead # Note that this also transforms \n\n into \r\n\r\n. # That is a feature. $recsep =~ s/\n/\r\n/g; } $recsep; }

So, you'll have to read the first few bytes (or up to the first \n), guess the line ending from that, and then use the recsep option to force the line ending.