in reply to ternary operator
There may be a Perl bug here. Because of operator precedence I'd have expected that the trinary experession shouldn't compile. The assignment operator has lower percedence than the trinary operator.
However the immediate answer to your problem is to fix the precedence issue. Here are two fixes:
1/ $test ne 'c' ? ($OPER='s') : ($OPER='c'); 2/ $OPER = $test ne 'c' ? 's' : 'c';
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: ternary operator
by japhy (Canon) on Jul 17, 2006 at 22:55 UTC | |
by GrandFather (Saint) on Jul 17, 2006 at 23:30 UTC | |
by Sidhekin (Priest) on Jul 17, 2006 at 23:45 UTC |