1
4

2 回答 2

4

You want

print "Character for $num is: ", chr($num), "\n";
于 2012-12-21T09:27:56.053 回答
-3

You can write something like :

foreach $num (2660..2670)
{
        print "Character for $num  is:",eval(qq!\"\\x{$num} \\n\"!);
}

The problem with your original program, is that perl cannot evaluate "\x{...}" because this evaluation is done before the interpolation of $num.

于 2012-12-21T07:52:05.753 回答