在评估之后Perl的$@会不会被定义?

在评估之后Perl的$@会不会被定义?,第1张

概述我正在研究 Mastering Perl的 “Error Handling and Reporting”章.在 perlvar的$@条目中,它说: The Perl syntax error message from the last eval() operator. If $@ is the null string, the last eval() parsed and executed cor 我正在研究 Mastering Perl的 “Error Handling and Reporting”章.在 perlvar的$@条目中,它说:

The Perl Syntax error message from the last eval() operator. If $@ is the null string,the last eval() parsed and executed correctly (although the operations you invoked may have Failed in the normal fashion).

现在我想知道eval何时可能无法正确执行,留下带有未定义值的$@.有这种情况吗?

解决方法 这是一种方法(但在你阅读它之前坐下来.;))

$@ = 123;eval q{  $@ = 456;  print ">>>$@<<<\n";  goto SKIP;};SKIP:print ">>>$@<<<\n";
总结

以上是内存溢出为你收集整理的在评估之后Perl的$@会不会被定义?全部内容,希望文章能够帮你解决在评估之后Perl的$@会不会被定义?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://www.54852.com/langs/1242402.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-06-06
下一篇2022-06-06

发表评论

登录后才能评论

评论列表(0条)

    保存