http://qs1969.pair.com?node_id=834296


in reply to Writing code that looks nice

I avoid using $_ and default arguments even in the shortest programs, except when i have to (in map, for example) or in very particular idioms, such as

for ($string) { s/^\s+//; s/\s+$//; }

(from perlfaq4.)

And i usually avoid postfix conditions.

But as everyone here says, it's a matter of taste.

Replies are listed 'Best First'.
Re^2: Writing code that looks nice
by Your Mother (Archbishop) on Apr 12, 2010 at 16:11 UTC

    I think that's more idiomatic as

    s/\A\s+|\s+\z//g for @strings; # or $string =~ /\A\s+|\s+\z//g;

    For the OP: I prefer short, natural language code over formal blocks and such any day. But the point you get to at the bottom of it all is, there will be disagreement so consistency is best / don't edit other hackers' code for style; fit in with whatever codebase you have. (update, put in missing "/", thanks webfiend!)