in reply to How Much Is Too Much (on one line of code)?

Before reading the other replies on this thread, my first reaction is that I found the snippet potentially confusing -- or possibly confused -- in the sense that its actual outcome is not obviously consistent with its intended outcome. In fact, the thing about the OP snippet that makes it too much work for my taste is figuring out what the intention really is.

Initially, I was worried that there might be a subtle trap involving operator precedence -- does the  if $country apply to the entire ternary operator, or just to its last expression? (I'd have to look that one up and hope the man page description is clear enough to illuminate this particular case.)

But on closer inspection, I see that it doesn't really matter what the scope of  if $country is: in the case where $country is "false" (numeric zero, empty string or undef), nothing will ever happen to change its value; in the case where it isn't false, a value of "gbr" will be set to an empty string, and any other value will have initial and final square brackets added, and have letters (if any) converted to upper-case, regardless how perl actually compiles that line. (I'd want to confirm whether its okay that original values like "GBR" and "Gbr" come out as "[GBR]" instead of empty strings.)

So when properly understood, it seems like the OP snippet is actually "parsimonious" -- but it is still potentially confusing and it takes a while to figure out why it works. I'd rather phrase it like this, to keep the conditions affecting value changes together in a single logical expression:

$country = ( !$country or $country eq 'gbr' ) ? '' : uc( "[$country] +" );

For me, it's not so much a question of "how much logic can fit reasonably on one line", but rather "how much can be left implicit in terms of operator precedence", or "how much effort is needed to figure out the programmer's intent".

Now I'll see what others had to say...

update: Great thread!! It seemed like my alternative was closest to grinder's reply (with tye's grudging assent), except that I'm not objecting to the original notion of assigning a value to $country in each of two consecutive lines.

The complaints about having "left-to-right" and "right-to-left" associations mixed in the single line of code were very apt, and really pinpointed the core of the problem with the OP snippet: bidirectionality in text is always a Bad Thing, to be avoided if at all possible. Always.