2011/7/14 Shlomi Fish <shlomif@shlomifish.org>
Hi Marc,

On Thu, 14 Jul 2011 07:18:55 -0700
Marc wrote:
use Text::CSV;
use DBI;
use Data::Dumper;
There is no "use strict;" and "use warnings;" at the beginning of the
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
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
"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
Well, if you do "use 5.012;" then strict will be turned on by default:


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
Or use something along the lines of "use Modern::Perl;" to also switch on
some useful stuff..

Paolo Gianrossi

(An unmatched left parenthesis
creates an unresolved tension
that will stay with you all day
-- xkcd

Search Discussions

Discussion Posts


Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 4 of 4 | next ›
Discussion Overview
groupbeginners @
postedJul 14, '11 at 2:19p
activeJul 14, '11 at 6:22p



site design / logo © 2021 Grokbase