Tim Johnson wrote: > Apparently (++$count) evaluates to 0, but I can't figure out why.
Nope. Always true. It just doesn'yt matter. Bill sorta threw us a red herring here. Seeing the conditiional operator distracts your attention to thinking about the product of the conditional, which is not even used here. What does happen is that both alternative expressions get evaluated before the appropriate one is assigned [to The Void in this case]. It's all byproduct. > So the second expression is evaluated first. Nope. They are evaluated in order. > From there it's pretty self-explanatory. (++$count) will always evaluate to TRUE, > since it will only get higher, and the first expression is evaluated. > > Maybe someone can enlighten us to some of the lesser known properties of the -- and > ++ operators? It's definitely counterintuitive. Not at all. The only counter intuitive thing here is the lack of short-circuit in the evaluation of alternative values within the conditional. Now we know. As to the prefix [++$var, --$var] and postfix [$var++, $var--] operators, that also is pretty intuitive once you get connected with it. If the increment operator precedes the variable name, it means "increment the variable then use its value." If the increment operator ifollows the identifier, it means "Use the current value, then increment the variable." Very intuitive. Joseph -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>