Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^4: Should I leave behind beautiful code or readable code?

by perrin (Chancellor)
on Mar 29, 2007 at 15:53 UTC ( #607299=note: print w/ replies, xml ) Need Help??


in reply to Re^3: Should I leave behind beautiful code or readable code?
in thread Should I leave behind beautiful code or readable code?

I realize that some perl coders can't seem to get out of bed in the morning without writing 5 map statements. The map is not that gratuitous here. The arrangement of the code though, with the buried uc() and the odd parentheses, is confusing. Here's a somewhat easier to read re-formatting:

return map { split(' ', uc $_, 2) } @somearray;
I might also break this into two, because the in-line makes the uncommon 3rd arg to split harder to pick up when scanning.
my @separated = map { split(' ', $_, 2) } @somearray; @separated = map { uc $_ } @separated;
Yes, it's probably slower. I don't care about the odd millisecond if it's easier to read. Some decent variable names would also make a big difference here.


Comment on Re^4: Should I leave behind beautiful code or readable code?
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://607299]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (12)
As of 2014-12-23 03:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (134 votes), past polls