Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

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?''


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

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, 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
  • 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.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others imbibing at the Monastery: (7)
    As of 2018-01-24 08:31 GMT
    Find Nodes?
      Voting Booth?
      How did you see in the new year?

      Results (256 votes). Check out past polls.