解决方法
看看
Devel::Trace
或
Devel::ebug
。
给定这个名为w.pl的程序:
#!/usr/bin/perl use strict; use warnings; my $answer = 42; if ($answer == 6 * 9) { print "everything is running fine.\n"; } else { warn "there must be a bug somewhere...\n"; }
您可以使用Devel :: Trace来监视执行:
perl -d:Trace w.pl
其中产生以下输出:
>> w.pl:6: my $answer = 42; >> w.pl:8: if ($answer == 6 * 9) { >> w.pl:11: warn "there must be a bug somewhere...\n"; there must be a bug somewhere...