Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

I'm curious to know when we should or shouldn't be abrupt to newbs regarding responses to their coding issues. This is a very theoretical question. I'm not claiming right or wrong, I'm just interested to know when past Perl code should be looked at as obsolete in our responses. For instance... suppose someone says:

I'm trying to iterate through an array, and I'm doing the following.

my @a = qw( a b c ); for ( my $i=0; $i<3; $i++ ){ say $a[$i]; }

We could bitch that we don't do "C for loops" and respond like this:

for my $elem ( @a ){ say $elem; }

But what if they wanted the iteration number? We could throw out (what I just learnt yesterday a trick that was back-ported from Perl6 into 5.12 (each for arrays))

while ( my ( $iter, $elem ) = each @a ){ say "Iteration $iter contains $elem"; }

...but where does it end? Do we have a common guide to follow when responding to questions here on PM?

ps. This question goes much deeper than coding questions, but you know that. Is there consistency is my inquiry...


In reply to When do we change our replies? by stevieb

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2024-04-19 17:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found