in reply to What is the difference between |= and ||=?
The fact that |= is a bitwise or and ||= is a logical or has a few consequences not shown in your code above. For example,
$var = 2; $var ||= 1; # $var now has the value 2. $var |= 1; # $var now has the value 3.
One non-obvious effect that is worth mentioning is shortcut behavior. The right hand side of ||= is not evaluated if the left hand side is true. But, both sides of |= are always evaluated.
Update: Corrected term bitwise
|
|---|