in reply to strange form in sub parameters

*;$ is the prototype definition of this subroutine and you can read all about it through the links already quoted above.

However, don't start using prototypes everywhere. They are rarely needed and in many places unneccessary or even wrongly used.

So the main rule is: don't use prototypes unless you certainly know what you are doing. And its use is NOT about checking the type of the sub's parameters.

In all honesty I can say that in all the years I have been programming Perl, I may have used prototypes once or twice only and I'm not entirely sure they were really necessary.

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

My blog: Imperial Deltronics

Replies are listed 'Best First'.
Re^2: strange form in sub parameters
by Athanasius (Archbishop) on Apr 03, 2015 at 04:35 UTC