Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

I used to show use strict; and use warnings; at the top of almost all of my example code. Then I read and thought a lot about MJD's "Twelve Views, #8: Why I Hate strict". From that article, there's this:

People come into the Usenet comp.lang.perl.misc group with some question, which they demonstrate with a four-line example program, and other folks there jump on them: ``Why didn't you use strict?'' Well, because it's a four-line example program I concocted as an example in my Usenet article---duh!

After digesting that article I kind of shifted my thinking a bit. Now, often I'll post only the code necessary to demonstrate my point. Usually it's stand-alone and runnable. Occasionally just a snippet. I will use lexical variables almost always, but may not explicitly demonstrate "strict" and "warnings" if they're not part of the solution, or part of the point I'm trying to make.

If I do advocate for the use of strictures and warnings, I'll also try to point out which aspect of "strict" would have caught some problem in the user's code, or which warning might have been raised had warnings been enabled. I feel this is far more helpful than simply carping "You should use strict and warnings." Another quote from the article:

Any time you hear anyone saying ``you should be using strict,'' you can be fairly sure they're not thinking about what they're saying, because strict has these three completely unrelated effects. A more thoughtful remark is ``you should be using strict 'vars''' (or whatever). As an exercise in preventing strict zombie-ism, ask yourself ``Which of the three strict effects do I find most useful? Which do I find least useful?''


Dave


In reply to Re: When do you include the usual use pragmas in your example code? by davido
in thread When do you include the usual use pragmas in your example code? by rjt

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!
  • 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, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others lurking in the Monastery: (3)
    As of 2014-09-18 05:52 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      How do you remember the number of days in each month?











      Results (108 votes), past polls