O'Reilly logo

Effective Perl Programming: Ways to Write Better, More Idiomatic Perl, Second Edition by brian d foy, Joshua A. McAdams, Joseph N. Hall

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

11. Warnings

Perl can be quite helpful in spotting suspicious code and letting you know about it. Most of the debugging skills you may have learned from other languages are just as applicable to Perl. When your program spits out pages and pages of warnings, start with the first ones.

There are several ways to enable warnings. Old-style Perl uses the -w switch on the command line:

image

You can also use command-line switches on the shebang line inside the program:

image

Modern Perl uses the warnings pragma inside the code (Item 99).

use warnings;

The trick ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required