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.

Use strict and warnings

Use strict and warnings - Perl Tutorial

From the course: Perl 5 Essential Training

Start my 1-month free trial

Use strict and warnings

- [Voiceover] Perl's strict and warnings pragmas are so important I can't imagine a situation where I wouldn't use them. Here's a working copy of warnings.pl from chapter 15 of the exercise files. Strict mode is now considered so necessary that it's turned on by default if you have a used version statement for a version of Perl over 5.12, and you see here we do have 5.18 in all of these scripts. So, strict mode is turned on by default and I would never even imagine turning it off. On the other hand, warnings mode is still optional and that's why it's important. So you notice I have use warnings, and again I have that in all of the scripts in this course. So I want to demonstrate why this is important down here in this function. So I'm going to go ahead and run this, and you see it says the result is four, and that's because this function it returns the number three element, so zero, one, two, three, it's the string that says four, returns that element from this array. And you notice…

Contents