见:Data::Dumper and UTF-8 by jl_post
用eval执行Dumper,再进行print。
#!/usr/bin/perl
#此文件是utf8编码
use utf8;
use Data::Dumper;
$Data::Dumper::Terse = 1; # 不要输出 "$VAR1 = "
binmode(STDOUT,":encoding(cp936)");
my $china="中国";
print Dumper($china); # "\x{4e2d}\x{56fd}"
print eval Dumper($china),"\n"; #中国
没有评论:
发表评论