I like the sentiment of the idea, but I wouldn't be surprised if we ended up with nearly as many posts like the one below (which subsequently get considered to move the code into the template*). xdg's suggestion to make recommended tags more prominent could help but certainly wouldn't solve the problem. I suspect diligence, patience, and gentle reminders to new users will continue to be required.

*Update: Then again, it might be possible to automatically remove empty templated code blocks after hitting the Preview button, since the text (if left unmodified) would be easy to identify. That would prevent considerations for superfluous template but would not solve the original problem of missing code tags.

Example post:

I want to use a regex to find all of the 2 digit numbers in a string like 'abc1cdef23gh456ijl78mn' but I can't get it to work. All of the digits are returned one at a time, but I only want the numbers that contain 2 digits (like 23 and 78). Can you help me? Here is my code: my $string = 'abc1cdef23gh456ijl78mn'; while( $string =~ m/(\d)/g ) { print "found $1\n"; }

Any code goes here


In reply to Re^2: Avoiding code tag considerations by bobf
in thread Avoiding code tag considerations by belg4mit

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.