in reply to One out of three ain't bad
Whenever you feel there's no intuitive way to do it, write a subroutine.
In this case, let's define, say,
Then you can do exactly_one($x, $y, $z) which is now cleaner than any other solution.sub exactly_one { 1 == grep $_, @_; }
|
|---|