Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
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 all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2017-12-13 02:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (344 votes). Check out past polls.

    Notices?