develooper Front page | perl.beginners | Postings from August 2009

Re: ||= operator

Thread Previous | Thread Next
From:
John W. Krahn
Date:
August 7, 2009 15:12
Subject:
Re: ||= operator
Message ID:
4A7CA6C7.1030609@shaw.ca
Admin wrote:
> Hi there,

Hello,

> is there a page that explains the ||= operator and similar operators?
> google is not quite finding the special characters in the first 10 hits.

$left ||= $right

is just short for:

$left = $left || $right

and || is the logical OR operator.  So if $left is TRUE then it retains 
the same value however if $left is FALSE it is assigned the value of $right.


John
-- 
Those people who think they know everything are a great
annoyance to those of us who do.        -- Isaac Asimov

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About