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? But when I've run the latter,
$bar always comes away with a value of 0, regardless of the value of
$foo.
This is particularly confusing, as the following snippet:
EX 3:
($foo == 1) ?
warn "Got 0\n" :
warn "Got 1\n";
is producing the results I expect.
Am I doing something stupid or missing something obvious?
Thanks,
Jeff Soules
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/