On Mon, Mar 29, 2010 at 10:02 PM, Jeff Soules <sou...@gmail.com> wrote:
> Hi all,
>
> Am I missing something?  I have the following chunks of code:
>
> EX 1:
>    if ($foo == 1){
>        $bar = 0;
>    }else{
>        $bar = 1;
>    }
>
> EX 2:
>    ($foo == 1) ?
>        $bar = 0 :
>        $bar = 1;
>
> These are logically equivalent, right?

No. ($foo == 1) is a list which always has a value of either 1 or 0 so
it really return a true value in both cases.

-- 
Jeff Peng
Email: jeffp...@netzero.net
Skype: compuperson

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