On Mon, 29 Mar 2010 10:02:15 -0400 Jeff Soules <sou...@gmail.com> wrote:
> ($foo == 1) ? > $bar = 0 : > $bar = 1; > Am I doing something stupid or missing something obvious? ($foo == 1) ? ( $bar = 0 ) : ( $bar = 1 ); Assignment has lower precedence than ?: It is done last. What you wrote above is: (($foo == 1) ? $bar = 0 : $bar ) = 1; Which assigns 1 to $bar regardless of what $foo is. -- Just my 0.00000002 million dollars worth, Shawn Programming is as much about organization and communication as it is about coding. I like Perl; it's the only language where you can bless your thingy. Eliminate software piracy: use only FLOSS. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/