in reply to Re^3: Sum group of numbers and display each number is on its own line -- plain way
in thread Dice roll chances

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.

  • Comment on Re^4: Sum group of numbers and display each number is on its own line -- plain way
  • Download Code