大佬教程收集整理的这篇文章主要介绍了为什么Perl发出的没有括号的“使用”转移是不明确的“警告?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
shift . 'some String'; # and not (shift) . 'some String'; # or shift() . 'some String';
这是否有意使某些句法结构更容易?还是仅仅是Perl解析器工作的方法呢?
注意:这是关于语言设计的讨论,而不是一个建议的地方
"@{[shift]}some String"
Warning: Use of "shift" without parentheses is ambiguous at (eval 9)[/usr/lib/perl5/5.8/perl5db.pl:628] line 2 (#1) (S ambiguous) you wrote a unary operator followed by something that looks like a binary operator that could also have been interpreted as a term or unary operator. For instance,if you know that the rand function has a default argument of 1.0,and you write rand + 5; you may THINK you wrote the same thing as rand() + 5; but in actual fact,you got rand(+5); So put in parentheses to say what you really mean.
恐惧是你可以写一些像shift.5这样的东西,它将被解析为shift(0.5).
以上是大佬教程为你收集整理的为什么Perl发出的没有括号的“使用”转移是不明确的“警告?全部内容,希望文章能够帮你解决为什么Perl发出的没有括号的“使用”转移是不明确的“警告?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。