in reply to Re^2: strange output from conditional operator
in thread strange output from conditional operator

(defined($var) ? $var) .= ('y' : $var .= 'n') if $el eq 'apple';
No, because there can be no ? without an accompanying :. Thus, the ‘middle’ assignment is parsed as you like (since the tokeniser hasn't seen a : yet, hence knows that it's still inside the conditional), but the ‘last’ one isn't (since the tokeniser believes it's done with the conditional after finding the second occurrence of $var):
(defined($var) ? $var .= 'y' : $var) .= 'n'

(Of course, the statement about every ? requiring an accompanying : is a lie, as regular expressions show; but you know what I mean. :-) )