http://www.perlmonks.org?node_id=606960


in reply to Should I leave behind beautiful code or readable code?

I beg to differ, but I find that neither beautiful nor readable. At the expense of sounding like an old fart, I would privilege readability over beauty, which is, of course, in the eye of the beholder anyway.

Especially for code you write for clients, I would shun dropping braces of maps (the speed optimisation is negligable) and implicit uses of $_. Spell it out:

return map {split( ' ', uc($_), 2)} @somearray;

This makes it pretty obvious that some sort of transform is being applied to @somearray, and that is what is being returned.

I used to omit return until the day I tried to return an anonymous hash reference...

• another intruder with the mooring in the heart of the Perl

Replies are listed 'Best First'.
Re^2: Should I leave behind beautiful code or readable code?
by jwkrahn (Abbot) on Mar 28, 2007 at 12:24 UTC
    The very fact that you are using map says outright that some sort of transform is being applied to @somearray irregardless of how many parenetheses or braces you apply or whether $_ is explicitly used.