in reply to Different ways of formatting/writing code

It's of course personal taste. I put the { on the same line as sub keyword, because I don't think it's important enough to warrant a line on its own. It also makes the code more compact, but that's secondary to me.

I also put a space before the opening curly bracket.

See perlstyle for some popular choices within the Perl community.

Update: after thinking a bit more about it, the right answer is probably that I use this style because the books I learned from used it, and it works well for me.

Replies are listed 'Best First'.
Re^2: Different ways of formatting/writing code
by Ratazong (Monsignor) on Dec 10, 2009 at 08:23 UTC
    I agree totally agree to your update: it depends on how you "grew up".
    For me it was learning C by reading the "bible" (K&R) as well as other books - and I really disliked the K&R-style (no own line for the opening brackets).
    And it were the tools I used for coding then (vi (without syntax-highlightning ...)) - I often got errors due to missing brackets ... and found it much easier to find them if the opening brackets are on a line on their own...

    Fortunately, my current company has not defined a style-guide on this topic - my previous had, which led to endless discussion (which style is the better one, how to enforce it ...) without making the code any better.