in reply to Re: Confused by Perl ternary operator
in thread Confused by Perl ternary operator
In this case, for arcane reasons, $param3 = @_ ? "Shift" : shift works as-is but is execution-order unsafe and if the expression were included in some other larger expression, could be quite a problem.
$param3 = @_ ? "Shift" : $_[0]; shift;
The preceding example would be the safe way to write it.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Confused by Perl ternary operator
by ysth (Canon) on Aug 23, 2004 at 23:36 UTC | |
by diotalevi (Canon) on Aug 24, 2004 at 00:13 UTC |