[thelist] Unicode (utf16) and Perl (5.6.1)

David Gray david_gray at 3b2.com
Fri Feb 15 08:36:00 CST 2002

I have a Unicode (utf16) file on a win2k system running perl v5.6.1 - I
want to do stuff to this file in Perl.

I've been playing with Unicode::String
<http://search.cpan.org/search?dist=Unicode-String> for a while and
unfortunately haven't been getting very consistent results doing regex
searches and I can't seem to pin down what I'm doing wrong.

I've been doing things like:
use Unicode::String;
$F = new Unicode::String;
open F,"<my_utf16_file.txt";
{ local $/ = undef;
  $F = <F>; }
$sep = new Unicode::String("\n\n");
@ura = split /$sep/,$F;
print $#ura;
just to try to see if I understand how to work with utf16 files, but
nothing works as expected...

Does anyone have any experience doing this sort of thing? Seeing some
working sample code that reads files and does some simple searches would
be invaluable right now.



More information about the thelist mailing list