- No doubt the first tip is to use strict in whatever code you write. It helps in avoiding the typo and many other errors which otherwise are real difficult to bebug.
- When using if it is not necessary to emboss the condition in ()’s when if is used as the last part of the statement.
- @ARGV is the array which holds all the parameters passed to a perl program through a command line.
- For conditions in perl “”, 0 , “0”, undefined is false, everything else is true.
- It is confusing for some people to remember how unless works. One can remember it in a simple way by saying if not this then this happens. i.e unless (people){do this}; can be interpreted as if not people do this.
- When you want to comment a large amount of code you can always use a condition which will always be false. eg. if (1 > 2) { ...... }
If anyone of you have any other perl tips which you follow as a practice, please leave it in the comments section. I would like to add it to the list with your name as contributor and let people efficiently do their perl coding.
No comments:
Post a Comment