我开始使用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}