You probably really shouldn't do any detecting :)
You should be liberal in what you accept s/[\r\n]+$//; and be strict in what you output binmode $fh, '...:crlf';
See also File::LocalizeNewlines and Encode::Newlines, PerlIO::eol and Devel::CheckOS
In reply to Re: Native newline encoding
by Anonymous Monk
in thread Native newline encoding
by salva
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |