Bryan R Harris wrote:
> 
> Can someone explain what:
> 
> $pi ||= 3;
> 
> ...means?  I just saw it in Programming Perl (pp 540), but it doesn't
> explain it.  Thx!

|| is the logical OR operator (see perldoc perlop) which says that if $pi is
TRUE then keep the current value of $pi but if $pi is FALSE then assign 3 to 
$pi.

That could also be written as:

unless ( $pi ) {
    $pi = 3;
    }



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to