Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
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 the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (7)
As of 2018-10-15 15:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When I need money for a bigger acquisition, I usually ...














    Results (82 votes). Check out past polls.

    Notices?