Jeff Peng wrote:
On Mon, Mar 29, 2010 at 10:02 PM, Jeff Soules <[email protected]> wrote:

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.

In neither of the examples above is ($foo == 1) a list.



John
--
The programmer is fighting against the two most
destructive forces in the universe: entropy and
human stupidity.               -- Damian Conway

--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/


Reply via email to