On Thu, 22 Nov 2001 22:45:54 -0500, in perl.unicode you wrote:
I've just tried using this in a form like:
my $i = "263a"
my $smiley = "\x{$i}";
and was disappointed that it didn't work.
No -- you need a literal. Just like reading in the string '050' from a
file and treating it as a number doesn't have the same effect as a
literal 050 in your code; the first gets converted to 50 (decimal) while
the second is treated as 050 (octal) == 40 (decimal).
And "\x7" . "5" is a beep and a number 5, not a lowercase letter u
(which is what "\x75" gives you).
If you really want to use something like "\x{$i}", you'll have to use
string eval, just like with the octal example ("$string = '050'; $num =
eval $string;") and the \x example ("$first = '\x7'; $second = '5';
$char = eval $first . $second;").
But you can just use
my $i = "263a";
my $smiley = chr hex $i;
or, more simply,
my $i = 0x263a;
my $smiley = chr $i;
So I'm making a feature request here.
I would suspect it is unlikely to be granted.
Cheers,
Philip