On Mon, Aug 10, 2009 at 11:22, Bryan R
Harris<bryan_r_har...@raytheon.com> wrote:
snip
> I think it's saying that just like:
>
>  $a += 2;
>
> is the same as:
>
>  $a = $a + 2;
>
> similarly:
>
>  $a ||= 3;
>
> is the same as:
>
>  $a = $a || 3;
>
> ... implying if $a is false, $a gets set to 3, otherwise it stays at
> whatever it was.
snip

That is exactly what it is saying.  The problem Shawn is pointing out
is that it requires you to

1. read about what += does
2. infer the behavior of ||= from that
3. then look up what || does

All of that is fine if you are reading perlop from start to finish,
but if you are trying to use it as a reference guide (by searching for
what you want to know about) it can lead to confusion and a belief
that it is not documented.  Perhaps we need a perlopref or perlopquick
like this:

=head2 C<||>

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.

=head2 C<<< X >>= Y >>>

This is equivalent to C<<<X = X >> Y>>> see,  C<<< >> >>> and C<=> for
more information.

=head2 C<X ||= Y>

This is equivalent to C<X = X || Y>, see C<||> and C<=> for more information.

=head2 C<X .= Y>

This is equivalent to C<X = X . Y>, see C<.> and C<=> for more information.


Sounds like yet another side project for me.

-- 
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/


Reply via email to