Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: How Much Is Too Much (on one line of code)?

by shmem (Chancellor)
on Jun 18, 2007 at 14:01 UTC ( #621793=note: print w/replies, xml ) Need Help??


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

IMHO there's not too much on that single second line, but it's written in a needlessly confusing way. The postfix if can be avoided with a conditional assignment:
my $country = $card->country; $country &&= $country eq 'gbr' ? '' : uc "[$country]";

Much clearer. But I agree with halley in that the two cases of the business logic should be handled in separate statements.

--shmem

_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://621793]
help
Chatterbox?
and monks are getting baked in the sun...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2018-07-20 09:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (427 votes). Check out past polls.

    Notices?