I'm on Windows and I have this small script:
use strict;
open F, '>:encoding(UTF-16LE)', "slask2.txt";
print F "1\n2\n3\n";
close F;
When I open the output in a hex editor I see
31 00 0D 0A 00 32 00 0D 0A 00 33 0D 0A 00
I would expect to see:
31 00 0D 00 0A 00 32 00 0D 00 0A 00 33 0D 00 0A 00
That is, I expect \n to be translated to 0D 00 0A 00, now it is translated
to three bytes.
It seems like I'm missing something basic, but the information is spread out
on several man-pages, and I have not been able to find where my error lies.
perl -v:
This is perl 5, version 12, subversion 2 (v5.12.2) built for MSWin32-x86-
multi-thread (with 8 registered patches, see perl -V for more detail)
Copyright 1987-2010, Larry Wall
Binary build 1202 [293621] provided by ActiveState
http://www.ActiveState.com
Built Sep 6 2010 23:36:03
--
Erland Sommarskog, Stockholm, esquel(_at_)sommarskog(_dot_)se