in reply to Confused by Perl ternary operator
instead of$param2 = @_ ? 'Shift' : shift;
But if you want to do what you're doing, you need some parentheses.@_ ? $param2 = 'Shift' : $param2 = shift;
I don't know what the parsing problem is, exactly, but no doubt someone else has already posted it while I've been composing this. :)@_ ? $param3 = "Shift" : ($param3 = shift);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Confused by Perl ternary operator
by diotalevi (Canon) on Aug 23, 2004 at 19:23 UTC | |
by ysth (Canon) on Aug 23, 2004 at 23:36 UTC | |
by diotalevi (Canon) on Aug 24, 2004 at 00:13 UTC | |
|
Re^2: Confused by Perl ternary operator
by Anonymous Monk on Aug 24, 2004 at 13:55 UTC |