Safety net for Perl
Perl by default is very forgiving. In order to make it more robust it is recommended to start every program with the following lines:
#!/usr/bin/perl
use strict;
use warnings;
use strict;
use warnings;
The two additional lines request from perl to catch various common problems in your code. They check different things so you need both. A potential problem caught by use strict; will cause your code to stop immediately when it is encountered, while use warnings; will merely give a warning (like the command-line switch -w) and let your code run.
To read more about them check their respective manual pages at strict and warnings.
Leave a Reply
You must be logged in to post a comment.