|Perl: the Markov chain saw|
Re: How Much Is Too Much (on one line of code)?by talexb (Canon)
|on Jun 18, 2007 at 18:31 UTC||Need Help??|
Without wanting to be influenced by the other comments, my opinion is that it's too much, without braces or a comment to make it clear in what order things happen, or why they are happening.
Without the braces I probably have to .. no, I have to look up what the precedence order is, or try it in the debugger. Yes, certainly after developing in Perl for ten years I should probably know that, but I don't. Also, the assignment to $country followed immediately by a re-assignment to $country isn't a style I love.
OK, (after trying it in the debugger) it does do the ternary first and the if statement within that .. that's what I expected.
To answer your question, no, this code is not clear.
Was there a comment explaining the business logic? The left side of my brain suggests ..
.. but the right side of my brain prevails, and provides a much better comment:
Above all, strive for clarity.