以下程序在第二次调用eval时停止.这是预期的吗?我读了perldoc -f eval,并且惊讶于没有显示打印"2:..."的输出.
eval {die("The curly braces seem to rescue me! Life moves on")};
print "1: $@\n";
eval die("Program actually terminates here! Subsequent prints are not shown");
print "2: $@\n";
Run Code Online (Sandbox Code Playgroud)
perldoc -f eval
Run Code Online (Sandbox Code Playgroud)eval EXPR eval BLOCK eval In the first form, often referred to as a "string eval", the return value of EXPR is parsed and executed as if it were a little Perl program.
... die调用它然后评估它返回的字符串.
...除了它不返回一个字符串.它使程序死亡,因此eval永远不会被调用.