in reply to Re^2: Parameter list wierdness
in thread Parameter list wierdness
That's about the quickest explanation. Ternary should never be used in void context. See my node Ternary in void context where I cleared up my ternary confusion as well. The ternary operator always returns the value present in its truth branch (for lack of a better term), that's why you shouldn't substitute it for if then constructs.my $value = (if condition? then this: else this);
an if then construct that warrants a ternary is similar to the following
This would equate to the ternaryif($some_var eq 'X') { $this_var = 'Run using X format'; } else { $this_var = 'Run using standard format'; }
$this_var = ($some_var eq 'X'? 'Run using X format':'Run using standar +d format');
|
|---|