On Sun, Aug 05, 2001 at 05:02:25PM -0400, Brett wrote:
> When calling a built in Perl function such my, print or open is
> it convention to only use ( ) s when the context calls for it,
> or is it better for consistency to just go ahead and always
> pass params to a function as a list?

Well, first, "my" isn't a function.  Is the reason that so many people
write my ($x) = 1; because people think it is?  Hmmmm.

But on to your question.  Have you looked at perlstyle?

       ·   Omit redundant punctuation as long as clarity doesn't
           suffer.

           ...

           Along the same lines, just because you CAN omit
           parentheses in many places doesn't mean that you ought
           to:

               return print reverse sort num values %array;
               return print(reverse(sort num (values(%array))));

           When in doubt, parenthesize.  At the very least it
           will let some poor schmuck bounce on the % key in vi.

           Even if you aren't in doubt, consider the mental
           welfare of the person who has to maintain the code
           after you, and who will probably put parentheses in
           the wrong place.

I like the first point.  I have looked at code with redundant
punctuation trying to work out the hidden gotcha that necessitated the
punctuation.  Leave it out if you can reasonably do so.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to