Apparently (++$count) evaluates to 0, but I can't figure out why.  So the second 
expression is evaluated first.  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.
 

        -----Original Message----- 
        From: WC -Sx- Jones [mailto:[EMAIL PROTECTED] 
        Sent: Mon 3/29/2004 9:01 PM 
        To: '[EMAIL PROTECTED]' 
        Cc: 
        Subject: What is happening here
        
        

        What is happening here -
        
        #! /usr/bin/perl
        use strict;
        use warnings;
        
        my $count;
        
        while(1) {
           (++$count) ? $count += $count-- : $count += $count++;
        
           print "$count\n"; exit if $count > 60_000;
           sleep 1;
        }
        
        __END__
        -Sx-
        

Reply via email to