The Perl Debugger #5

use strict;

Second- Did you use strict?

use strict requires an element of discipline in your coding, but it also catches a number of common problems.

  • Variables must be properly declared before use

  • Bareword identifiers must be subroutines

  • You can't use symbolic references such as:

                 use strict 'refs';
                 $ref = \$foo;
                 print $$ref;        # ok
                 $ref = "foo";
                 print $$ref;        # runtime error; normally ok

These are otherwise legal perl that will help you to hang yourself if you aren't careful.

<< Previous | Index | Next >> Copyright © 2002 Daniel Allen