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

Ovid,
I really don't think the second line is "too much" but it doesn't seem like a good idea either. It seems like the right thing to do would be to overload the country() method and abstract away the problem. Obviously that might not be possible given how country() is used elsewhere in the code.

An alternative might be:

my $country; if ($country = $card->country) { $country = $country eq 'gbr' ? '' : uc "[$country]"; }

Cheers - L~R

Replies are listed 'Best First'.
Re^2: How Much Is Too Much (on one line of code)?
by duckyd (Hermit) on Jun 21, 2007 at 02:35 UTC
    Since we're nitpicking a bit, I'll mention that I was wondering when this layout of the ternary operator would appear :)