Jeff 'japhy' Pinyan wrote:
> On Mar 30, WC -Sx- Jones said:
>
> >my $count;
> >
> >while(1) {
> > (++$count) ? $count += $count-- : $count += $count++;
> >
> > print "$count\n"; exit if $count > 60_000;
> > sleep 1;
> >}
>
> The main problem is the PRECEDENCE. Your ? : line is run like so:
>
> ((++$count) ? ($count += $count--) : $count) += $count++;
Have you tested this? I don't see the precedence issue happening here. Could
you try duplicating these reults with code explicitly specifying the precedence
you show? I do not think you are going to find that the outer parentheses you
show represent the actual precedence. Remember that the ? and : are not
different operators, but different parts of the same operator. If the +=
operator has a higher precedence than ?, it will also have a higher precedence
than :.
Joseph
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>