测试文件:
#!/usr/bin/perl
use utf8;
use strict;
use warnings;
my $var = 'Здравствуйте';
print $var;
我们在调试器中运行它:
$ perl -d ./test.pl
Loading DB routines from perl5db.pl version 1.55
Editor support available.
Enter h or 'h h' for help, or 'man perldebug' for more help.
main::(./test.pl:7): my $var = 'Здравствуйте';
DB<1> p $var
Wide character in print at (eval 8)[/usr/share/perl/5.30/perl5db.pl:738] line 2.
at (eval 8)[/usr/share/perl/5.30/perl5db.pl:738] line 2.
eval 'no strict; ($@, $!, $^E, $,, $/, $\\, $^W) = @DB::saved;package main; $^D = $^D | $DB::db_stop;
print {$DB::OUT} $var;
' called at /usr/share/perl/5.30/perl5db.pl line 738
DB::eval called at /usr/share/perl/5.30/perl5db.pl line 3138
DB::DB called at ./test.pl line 9
Здравствуйте
DB<2> x $var
0 '\x{0417}\x{0434}\x{0440}\x{0430}\x{0432}\x{0441}\x{0442}\x{0432}\x{0443}\x{0439}\x{0442}\x{0435}'
- 如何摆脱
p
命令后的“打印宽字符”警告? - 如何使用转储变量时让调试器打印文本而不是符号代码
x
?