Perl now accepts UTF-16 source.
% perl foo-u.pl
5.008005
% hexdump -C foo-u.pl
00000000 00 70 00 72 00 69 00 6e 00 74 00 20 00 24 00 5d
.p.r.i.n.t. .$.]|
00000010 00 2c 00 20 00 22 00 5c 00 6e 00 22 00 3b 00 0a |.,..".\.n.".;..|
00000020
So far so good.
But once the source spans more than two lines the camel falls into
indigestion, even when the line is empty.
% perl foo-u.pl
Bareword found where operator expected at foo-u.pl line 2, near ""
(Missing operator before r?)
Bareword found where operator expected at foo-u.pl line 2, near ""
(Missing operator before i?)
Bareword found where operator expected at foo-u.pl line 2, near ""
(Missing operator before n?)
Bareword found where operator expected at foo-u.pl line 2, near ""
(Missing operator before t?)
Scalar found where operator expected at foo-u.pl line 2, near ""
(Missing operator before ?)
syntax error at foo-u.pl line 2, near ""
Unmatched right square bracket at foo-u.pl line 2, at end of line
Execution of foo-u.pl aborted due to compilation errors.
% hexdump -C foo-u.pl
00000000 00 0a 00 70 00 72 00 69 00 6e 00 74 00 20 00 24
...p.r.i.n.t. .$|
00000010 00 5d 00 2c 00 20 00 22 00 5c 00 6e 00 22 00 3b |.].,..".\.n.".;|
00000020 00 0a |..|
00000022
It's just that perl does not correctly handle UTF-16 newline in the
script (\x00\x0a in UTF-16BE). IMHO I doubt the usefulness of UTF-16
scripts but we should obviously fix this so it works as advertised.
Dan the Encode Maintainer