From the course: Perl 5 Essential Training

Unlock the full course today

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

Whitespace and comments

Whitespace and comments - Perl Tutorial

From the course: Perl 5 Essential Training

Start my 1-month free trial

Whitespace and comments

- [Voiceover] Comments and whitespace are an important part of any source code file. This is even more important in a scripting language where the code tends to be more fluid. Here's a working copy of countlines.pl from Chapter 3 of the exercise files. And in this file, you'll notice that there is whitespace, there's a blank line here, there's a blank line there, there's a space here, but there's also all these new lines. All the new lines also count as whitespace. In fact, in Perl, whitespace can be any of space characters, tab characters, new lines, carriage returns, and a few other less common characters. Whitespace is mostly ignored in Perl. For example, I'll go ahead an run this, you'll see the result, it's counting the lines in this file, we've seen this before. I can go ahead and I can take out all kinds of whitespace here, like that, and I could do this all along here. I'm gonna go ahead and just finish taking out all the whitespace in this main function, of course not within…

Contents