On Fri, Aug 14, 2009 at 18:01, Noah Garrett Wallach<noah-l...@enabled.com> wrote: > Telemachus wrote: >> >> On Fri Aug 07 2009 @ 2:55, Admin wrote: >>> >>> Hi there, >>> >>> is there a page that explains the ||= operator and similar operators? >>> google is not quite finding the special characters in the first 10 hits. >> >> Google and punctuation don't mix well, apparently. >> >> In any case, try perldoc perlop in a terminal or online: >> http://perldoc.perl.org/perlop.html >> > > thanks > > I searched the docs for ||= > here is the result > > Search results for query "||=" snip
All the information you need is in [perlop][1], it just requires you to infer the behavior of ||= from the information given. I am working on a [reference version of perlop][2] (called perlopref) that will hopefully make this easier. The relevant pieces of perlop are Assignment Operators "=" is the ordinary assignment operator. Assignment operators work as in C. That is, $a += 2; is equivalent to $a = $a + 2; although without duplicating any side effects that dereferencing the lvalue might trigger, such as from tie(). Other assignment operators work similarly. The following are recognized: **= += *= &= <<= &&= −= /= |= >>= ||= .= %= ^= //= x= Although these are grouped by family, they all have the precedence of assignment. This tells you that ||= is like +=, that is $a ||= 2 is the same as $a = $a || 2. Logical or is well documented in its section of perlop: C−style Logical Or Binary "||" performs a short‐circuit logical OR operation. That is, if the left operand is true, the right operand is not even evaluated. Scalar or list context propagates down to the right operand if it is evaluated. [1] : http://perldoc.perl.org/perlop.html [2] : http://github.com/cowens/perlopref -- Chas. Owens wonkden.net The most important skill a programmer can have is the ability to read. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/