Hi,

sam lehman <[EMAIL PROTECTED]> asked:
> i got his code from a program i found, and i was wondering 
> that the ? and 
> the : are for?
> 
> $target = (@digits % 2) ? ($digits[int(@digits/2)]) : 
> ([EMAIL PROTECTED]/2-1]);

This is the so-called ternary operator. It's roughly
equal to saying

if( (@digits % 2) > 0 ){
  $target = $digits[int(@digits/2)];
} else {
  $target = [EMAIL PROTECTED]/2-1];
}

HTH,
Thomas

-- 
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