On Mon, 15 Nov 2004 16:34:35 +0100, Ing. Branislav Gerzo <[EMAIL PROTECTED]> 
wrote:

> ok I understand, but I don't know why my line doesn't work. I thought
> (exp) ? (true) : (false) is the same as if (exp) {  } else { }

Here is an OLD example of short-circuited presedence issues:

#! /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__


Or, a practical example -

#! /usr/bin/perl
use strict;
use warnings;

my $count;
my $index;
my $str;

while (++$index) {
   $count = $index;

   while(1) {
     (++$count) ? $count += $count--
                : $count += $count++;

     $str = unpack("B32", pack("N", $count));
     print "$count \tis binary $str\n";
     last if $count > 60_000;
     sleep 1;
   }

exit if $index > 255;
}

__END__


Please read the whole thread here:

http://groups.google.com/groups?hl=en&lr=&safe=off&threadm=40853BDD.7050901%40insecurity.org&rnum=84&prev=/groups%3Fnum%3D100%26hl%3Den%26lr%3D%26safe%3Doff%26q%3Dyouve%2BJones%2BSx%2BPerl%26btnG%3DSearch


-- 
WC -Sx- Jones
http://insecurity.org/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to