Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Embracing functions with parentheses

by eyepopslikeamosquito (Canon)
on Mar 16, 2005 at 10:31 UTC ( #439897=note: print w/ replies, xml ) Need Help??


in reply to Embracing functions with parentheses

For user-defined functions, I always use parens. This is being kind to the Perl parser, making it easier and less error-prone to switch between "use" (compile-time) and "require" (run-time). I've seen Perl newbies spend hours trying to figure out what is wrong because they didn't use parens when calling their user-defined functions. For example:

use strict; Fred; sub Fred { print "in function Fred\n" }
produces the error Bareword "Fred" not allowed while "strict subs" in use at fn.pl line 2..

Re style guide, I quite like Abigail's My coding guidelines. If you know of any other good ones, please let me know, because I hope to (eventually) write a tutorial that will include recommendations on Perl style.


Comment on Re: Embracing functions with parentheses
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://439897]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2015-07-04 20:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (60 votes), past polls