One of the things that annoys be about this "use strict" thing is that many people act as if "use strict" is the goal.

It isn't. And only the programmer who just past the novice stage himself will think so.

"use strict" can aid you to write good programs. But it isn't a goal in itself. And just patching your program so it satisfies "use strict" may improve your code a little bit, but it's a far cry from good programming.

Say, for instance, someone posts a code fragment that uses, inside an if statement inside a sub something like:

foreach $thingybob (@thingybobs) { ... }
where $thingybob is only used inside the foreach. The typical grasshoppers Pavlov reaction will be "I've no idea how to solve your problem, but you should use strict". So, the OP slaps "use strict" on his program, notices the compile failure, remembers to declare all the variable, and puts "my $thingybob;" right below the "use strict" on top of his program. Hooray! Code now compiles under "use strict". Did his code actually increase in quality? No. In fact, I'd consider his code of less quality.

Good advice (but still likely to not be relevant to his problem) would have been to tell him about narrow scopes. Writing

foreach my $thingybob (@thingybobs) { ... }
is what you want to see if you want better code. And that's the advice (if you insist on giving non-problem related advice) you should give.

Don't focus on a possible tool. Focus on the goal.


In reply to Re^2: Should code that does not use strict even be considered here? by JavaFan
in thread Should code that does not use strict even be considered here? by morgon

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.