@array = reverse;
and
@array = reverse $_;
两者不同。 @array = reverse
不隐式使用 $_
。我们必须显式声明 $_
。这是一个非常奇怪的情况,默认情况下不使用 $_
。是错误吗?
最佳答案
据我了解 reverse documentation , reverse
适用于数组,因此它应该使用 @_
而不是标量 $_
?
文档说“在标量上下文中不带参数使用,reverse()
反转$_
。” [强调已添加]
$_ = "dlrow ,olleH";
print reverse; # No output, list context
print scalar reverse; # Hello, world
https://stackoverflow.com/questions/7871120/
相关文章:
fonts - Safari 放大/缩小破坏页面布局(不能很好地改变字体大小)
common-lisp - sbcl 上的 undefined variable ,而不是 clis
c#-4.0 - Dataset/datatable是值类型还是引用类型
wordpress - 如何检查它是哪个级别的 wordpress 类别?
asp.net-mvc - 架构决策 : ASP. NET MVC 和 Entity Framewo
oop - R : Use a different base field/corpus 中的运算符重