Indeed binmode with the appropriate layer (see PerlIO) or even directly specifying it in open's mode string may well be the best way to go.
I'd also recommend reading this thread in which a similar issue is discussed at length.
In reply to Re^2: Conversion of unix LF to DOS LF issues
by blazar
in thread Conversion of unix LF to DOS LF issues
by master_son
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |