Strict vars forces you to scope your variables. This is a very good thing. If you don't get why you have probably not read the coping with scoping link and/or worked on debugging code with over 1000 lines and wide use of globals.
Here is a very simple 'vars' typo example that will be caught by strict, will not be caught by warnings and is not 'obvious'. Typos with varnames are the statistically most common cause of software bugs....
use warnings; #use strict; my $recieved = 0; print "Do you get it (y/n)?"; $received = <>; print "Got $recieved" if $received =~ /y/;
Strict and warnings are complementary - they have some overlap but the overlap is imperfect, thus the usefulness of both comes into play.
|Replies are listed 'Best First'.|
Re: Use strict warnings and diagnostics or die
by jonadab (Parson) on Feb 03, 2003 at 15:14 UTC
by tachyon (Chancellor) on Feb 03, 2003 at 23:55 UTC