perl-unicode

do{use utf8; ...}

1998-10-13 11:55:54
Another one:

   $ perl -le 'print unpack("H*", join("", map do{use utf8; chr($_)}, 0x7F, 
0xFF, 0xFFF))'
   7fffff

It does not look like it is the UTF-8 version of chr() which is used
above, as the result is the same if we take out use utf8:

   $ perl -le 'print unpack("H*", join("", map do{chr($_)}, 0x7F, 0xFF, 0xFFF))'
   7fffff

and we get what we expect when put it outside:

   $ perl -le 'use utf8; print unpack("H*", join("", map do{chr($_)}, 0x7F, 
0xFF, 0xFFF))'
   7fc3bfe0bfbf

The first thing I tried was actually:

   map { use utf8; chr($_); } ...

but I was told: "use" not allowed in expression at...
What would it take to make that one legal?

[perl5.005_52, Linux, i586]

Regards,
Gisle

<Prev in Thread] Current Thread [Next in Thread>