Don't ask to ask, just ask | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
That is the trinary operator ?:. It parses like this: return (($status == 0) ? 0 : 1);. The first of the terms is evaluated in bool context. If true, the whole trinary takes the value of the expression after the question mark. If false, it takes the value after the colon. If $status is an instance of a class with overloaded operators, it may not return a simple value. Or else it may be a floating point value, with the accompanying accuracy problems in comparisons. This expression forces $status into numeric context and converts any non-zero $status to 1. The returned value is a perl numeric type, whatever $status may be. Update: By the way, your title suggests you misread the == operator as assignment. It's numeric comparison for equality, instead. Minor clarification in text. After Compline, In reply to Re: variable set to 0 ? 0 : 1
by Zaxo
|
|