Re: Tertiary Operator Question

2001-08-13 Thread David Rankin
Thanks! I've been trying to figure that out for hours! Now I actually get it! -Dave On Tue, 14 Aug 2001 00:09:59 +0200, Paul Johnson wrote: >On Mon, Aug 13, 2001 at 05:50:14PM -0400, David Rankin wrote: > >> #!/usr/bin/perl -w >> use strict; >> my $num=3; >> my $nextnum; >> $num==3 ? $nextnu

Re: Tertiary Operator Question

2001-08-13 Thread Ken
: "Paul Johnson" <[EMAIL PROTECTED]> To: "David Rankin" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Monday, August 13, 2001 4:09 PM Subject: Re: Tertiary Operator Question > On Mon, Aug 13, 2001 at 05:50:14PM -0400, David Rankin wrote: > > >

Re: Tertiary Operator Question

2001-08-13 Thread Ken
It's a precedence problem. I've been trying to parenthesize this according to the precedence chart in "Programming Perl" but haven't been having any luck. Maybe someone elses brain is working better than mine and can tell us how this is being seen by Perl with parens! If you put parens around t

Re: Tertiary Operator Question

2001-08-13 Thread Paul Johnson
On Mon, Aug 13, 2001 at 05:50:14PM -0400, David Rankin wrote: > #!/usr/bin/perl -w > use strict; > my $num=3; > my $nextnum; > $num==3 ? $nextnum=4 : $nextnum="unknown" ; > print $nextnum; > > It prints "unknown". I'd expect it to print "4" because $num==3 would > evaluate to true. You're bei