2
#!/usr/bin/env perl
use warnings;
use 5.012;
say "no semicolon"
say "World";
say "World";
say "World";
say "World";
say "World";
# syntax error at ./perl1.pl line 7, near "say"
# Execution of ./perl1.pl aborted due to compilation errors.
#!/usr/bin/env perl
use warnings;
use 5.012;
my $character = "\x{ffff}";
say "Hello";
say "Hello";
say "Hello";
say "Hello";
say "Hello";
# Unicode non-character 0xffff is illegal for interchange at ./perl1.pl line 5.
# Hello
# Hello
# Hello
# Hello
# Hello
为什么第二个脚本不告诉我,有一个编译时错误?
当我不能 - 用“警告FATAL => qw(all);” - 用Try :: Tiny或block-eval捕获错误,我可以得出结论,它是编译时错误吗?
#!/usr/bin/env perl
use warnings FATAL => qw(all);
use 5.012;
use Try::Tiny;
my $character;
try {
$character = "\x{ffff}";
} catch {
die "---------- caught error ----------\n";
};
say "something";
# Unicode non-character 0xffff is illegal for interchange at ./perl1.pl line 9.
该程序已执行,因此程序中可能没有编译时错误...如果出现编译时错误,程序将无法运行。 – tadmc 2011-02-27 01:02:31
如果我会问:“......,我可以得出结论吗,它不是运行时错误,也不是运行时警告”,那可以吗? – 2011-02-27 07:11:29