in reply to Re: perlstyle - Unclear wording
in thread perlstyle - Unclear wording

How does a parenthesis “match on current line”?
Like-a-so:
( ($a eq "foo") && ($b eq "bar") )
In each case, the close parens "matches" it's open parens (the converse is also true). So, if it "matches on current line", the open and close are on the same line.

thor

Feel the white light, the light within
Be your own disciple, fan the sparks of will
For all of us waiting, your kingdom will come

Replies are listed 'Best First'.
Re^3: perlstyle - Unclear wording
by Aristotle (Chancellor) on Nov 18, 2005 at 14:54 UTC

    Doesn’t that make it a strangely particular style rule, though? It doesn’t make sense for someone like me who spaces all parens anyway, as in:

    ( ( $a || $b ) && ( $c || $d ) )

    And it looks weirdly out of place in code of someone who doesn’t, as in:

    (($a || $b) && ($c || $d) )

    Makeshifts last the longest.

      In the same vein, the following points from perlstyle don't make sense for me:
      • Be consistent.
      • Be nice.
      as I am neither. :-) perlstyle is a list of suggestions, not rules. If you like to put spaces around all of your parentheses, then you're obeying the rule by default. If someone follows the second style, they have a couple of choices; they can ignore the "rule" altogether or they can put a space after the far left opening parenthesis (which is what I do, incidentally). I agree that the docs might be cleaned up a little bit with a simple example.

      thor

      Feel the white light, the light within
      Be your own disciple, fan the sparks of will
      For all of us waiting, your kingdom will come