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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.