in reply to Why this simple code doesn't work?
Two more comments:
- Don't add prototypes to your subroutine declaration. Adding the empty round brackets after the subroutine name, means that this subroutine will not take any parameters! Obviously this is incorrect. Just drop the round brackets and forget you ever heard anything about Perl subroutine prototypes.
- Don't call your subroutines with a prepended "&". It is "old style" dating back to Perl 4! The effect of it now is that any prototypes are ignored. In the few cases they are actually usefully used, you surely do not want to do that and in all other cases it saves you one character less to type.
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: Why this simple code doesn't work?
by tobyink (Canon) on Mar 02, 2012 at 17:13 UTC | |
by CountZero (Bishop) on Mar 02, 2012 at 17:44 UTC | |
Re^2: Why this simple code doesn't work?
by uksza (Canon) on Mar 02, 2012 at 22:25 UTC | |
Re^2: Why this simple code doesn't work?
by JavaFan (Canon) on Mar 02, 2012 at 17:29 UTC | |
by CountZero (Bishop) on Mar 02, 2012 at 18:06 UTC | |
by JavaFan (Canon) on Mar 02, 2012 at 20:24 UTC | |
by CountZero (Bishop) on Mar 03, 2012 at 10:26 UTC |
In Section
Seekers of Perl Wisdom