Windows上で、EUC-JPでLFなファイルを作る

binmode関数の第二引数できちんと指定すればOK(`・ω・´)

open my $th, '>', 'out.txt';
binmode $fh, ':raw:encoding(euc-jp)';

:raw

でバイナリモード

:encoding(euc-jp)

EUC-JPで出力の意味

open my $th, '>:raw:encoding(euc-jp)', 'out.txt';

てかopen関数で指定しても良かった(;´Д`)

ちなみに

binmode $fh, ':crlf';

でバイナリモードからテキストモードに戻せる