From the course: Perl 5 Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Selective use of comments and whitespace

Selective use of comments and whitespace - Perl Tutorial

From the course: Perl 5 Essential Training

Start my 1-month free trial

Selective use of comments and whitespace

- [Voiceover] Comments and white space are important tools in making your code easy to read and manage long after you originally wrote it. Here's BW Better.pm from chapter 15 of the exercise files. This version's a little bit cleaned up and has comments added. Good comments are simple, direct, informative and not overly verbose. Not too little, not too much, just right. So here we have a little header at the top, sometimes my headers are bigger than this and they might have a little bit of a history but if they get to be more than five or six lines, I'm gonna cut some of that stuff out, maybe put it in a readme file or something like this, in this case this is really sufficient. It says what it is, it's an example Perl module for this course. Here's my constructor, again, I have just a simple comment up at the top, this one's two lines long, it says that it's a constructor, it tells how to use the constructor and it mentions that if you omit the number a zero will be provided, and…

Contents