6
A
回答
7
a ||= b
类似于a = a || b
,所以:
$sheet->{MaxCol} ||= $sheet->{MinCol};
是类似于:
$sheet->{MaxCol} = $sheet->{MaxCol} || $sheet->{MinCol};
每池上的评论,所不同的是a ||= b;
只判断a
一次,它评估a
之前b
。这在a
是神奇的或不是标量时很重要。
5
$sheet -> {MaxCol} ||= $sheet -> {MinCol};
具有相同的效果,
if (!$sheet->{MaxCol}) { $sheet->{MaxCol} = $sheet->{MinCol}; }
或
$sheet->{MaxCol} = $sheet->{MinCol} unless $sheet->{MaxCol};
+0
+1更清楚地解释了这实际意味着 – Andomar
相关问题
- 1. operator +()和operator + =()
- 2. Prolog - > operator-operator expected
- 3. 重载operator-,operator <和operator>
- 4. 'std :: operator <<'operator <<'不匹配'std :: operator <<
- 5. groovy^operator
- 6. C#'+ ='Operator
- 7. ruby operator“=〜”
- 8. 重载运算符<< operator ==和operator!=
- 9. 什么是“:: operator new”和“:: operator delete”?
- 10. operator ++()和operator ++(int)有什么区别?
- 11. std :: operator中的“operator <<”不匹配
- 12. Operator&in haskell?
- 13. class Bar {operator Foo(); }
- 14. 'operator-'不匹配
- 15. eval String-cmp-operator?
- 16. operator + = yield 0
- 17. C++ std :: function operator =
- 18. operator [] list cpp
- 19. in operator in C#
- 20. Mongo $ in operator performance
- 21. Overloading >> operator
- 22. Spring react - operator =>
- 23. Char to Operator C++
- 24. scanf with^operator
- 25. Sql or operator
- 26. Elvis Operator with * ngFor
- 27. shell>&operator?
- 28. VB Macro Like Operator
- 29. 'operator ='不匹配
- 30. Stream Operator Overloading
http://perldoc.perl.org/perlop.html –