http://qs321.pair.com?node_id=1226986


in reply to Re: New Discovery!!! (sub call without parentheses) - Coding Style
in thread New Discovery!!! (sub call without parentheses)

Two very good points there.

I always use parens on my user-defined functions whether I've got parameters or not. Kind of a habit actually now that I'm fluent in more than just a couple of languages, most of which enforce using parens. In fact, thinking about it, I think Perl's the only language which *doesn't* enforce parens if a function is pre-declared. Also, at a glance (at least with my own code), it's easier to identify built-ins, as I typically don't use parens for them (eg: sleep 10;).

The only time I'll leave parens off of a call, is if it's a method call where I'm not sending in any params:

my $object = My::Thing->new(speak => 'hi'); ... $object->speak;