OK, maybe I should have given more context: I was trying to strip of the ending of words, do something with the words and put the ending back on, like this: my ($end) = $word =~ /(e?s)$/ || ('');
... #do something with $word
$word = "$word$end";
If the word does not end in s/es, I get a warning about uninitialized variables where I append $end - which I wanted to avoid.
I thought about the ternary, but I don't want to evaluate the regex twice.
I simplified the problem because IMO it boils down to the question if I can enforce list context on the part before the ||. But maybe I oversimplified it.
Thanks anyway for the suggestion.
pike |