3.6. Accident Prevention

These tips fall into the category of installing sprinklers instead of polishing your fire hose.

3.6.1. Be Strict

Put the directive use strict as the first line (after the #! line if there is one) of every file (including modules you write; strictness is lexically scoped, not program scoped). Especially if you don't understand why. This makes Perl, well, stricter about things that you could get away with without it that are nevertheless usually mistakes. It is telling that the one group of people whose expertise would most allow them to get away without using strict (the uppermost echelon of Perl experts) is the most adamant about its indispensability.[8]

[8] Except when they're entering the Obfuscated Perl Contest (www.tpj.com/contest ...

Get Perl Debugged now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.