Second, why would you not use the tools if they exist?
Of course, 1nickt++, I fully agree with you on that.

I was saying these things in the context of someone who is obviously a beginner not only in Perl but most probably also in programming, someone who states not to be able to figure out how to sum up five numbers of an array. I think that this person should really learn to use loops and, in that case, nested loops, as shown by Discipulus.

So, yes, we should definitely be using tools when they exist and make our lives easier. But, IMHO, a beginner should really learn and understand the basic techniques of programming before using tools that automatize standard, almost boiler-plate, code. That's all I was saying.

As an example, there is probably no reason to code a sorting algorithm in Perl for a real-life problem, since we have the sort built-in, and this is a very useful and efficient tool that we should use when we need to sort a list or an array. But it is probably very useful, for pedagogical purposes, for a beginner to understand and be able to implement manually a couple of the most common sort algorithms.

But I suspect we probably mostly agree on this.


In reply to Re^4: Sum group of numbers and display each number is on its own line -- plain way by Laurent_R
in thread Dice roll chances by Anonymous Monk

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.