Hi Marc, On Thu, 14 Jul 2011 07:18:55 -0700 Marc <sono...@fannullone.us> wrote:
> >> #!/usr/bin/perl > >> use Text::CSV; > >> use DBI; > >> use Data::Dumper; > > > > There is no "use strict;" and "use warnings;" at the beginning of the file: > > I see this quite a bit on this list (and elsewhere) and I think it's > very good advice, so this morning I got to thinking. If these pragmas are as > important as they are, why is it that they aren't turned on in Perl by > default? Because doing so will break old code. perl 4 and below didn't have "use strict;" and the -w flag (which is the precursor to the now more recommended "use warnings;") was also introduced a bit later. So if we turn them on by default, then it will break a lot of code. > How about if we make them the default settings in 5.16 and then add > "use nostrict;" and "use nowarnings;" for when someone wants to turn them > off? Well, if you do "use 5.012;" then strict will be turned on by default: http://www.effectiveperlprogramming.com/blog/468 Also, there's http://beta.metacpan.org/module/Modern::Perl and doing "use Moose;" (see http://www.iinteractive.com/moose/ ) will also enable "use strict;" and "use warnings;". > In the grand scheme of things I'm still relatively new to all this, but > it makes total sense to me. If they should be used in most every script, why > waste the time and thought of always having to remember (or remind others) to > add them? Well, a good idea is to configure your editor to add them for you automatically. Regards, Shlomi Fish -- ----------------------------------------------------------------- Shlomi Fish http://www.shlomifish.org/ List of Portability Libraries - http://shlom.in/port-libs If God exists and is the ego‐maniacal, sadistic and helpless creature that is described in the Old Testament, then we’re in deep trouble. Please reply to list if it's a mailing list post - http://shlom.in/reply . -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/