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 –