小编Que*_*ner的帖子

从Hex值打印Unicode的Perl程序

我开始使用Perl,并且对于如何在给定十六进制字符串变量的情况下呈现unicode字符感到困惑.

#!/usr/bin/perl
use warnings;

foreach my $i (0..10000) {
    my $hex = sprintf("%X", $i);
    print("unicode of $i is \x{$hex}\n");
}
print("\x{2620}\n");
print("\x{BEEF}\n");
Run Code Online (Sandbox Code Playgroud)

给我警告: Illegal hexadecimal digit '$' ignored at perl.pl line 9.

没有值打印 \x{$hex}

string unicode perl text-rendering

6
推荐指数
1
解决办法
494
查看次数

标签 统计

perl ×1

string ×1

text-rendering ×1

unicode ×1