in reply to Printing largest number in array using loops and if statement

Looks OK, but now do it again and uncomment the use strict; pragma.

Always use strict;, even for small programs until it becomes second nature.

Is there a reason why you added use 5.006?

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Replies are listed 'Best First'.
Re^2: Printing largest number in array using loops and if statement
by chromatic (Archbishop) on Jan 17, 2010 at 08:09 UTC
      I fully agree that including a minimum Perl version is good coding practice, provided of course you know what you are doing and why you are doing it. In this case there is no reason to have a minimum version of Perl 5.6 and as the code was an exercise, one must check every statement and see whether it is correct and necessary.

      Update: Actually, according to Perl::MinimumVersion, the use warnings; pragma pushes the miminum version up to Perl 5.6.

      CountZero

      A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

        In this case there is no reason to have a minimum version of Perl 5.6....

        Indeed there is! This helps to prevent a future version of Perl 5 from using the wrong version of the grammar with this program.

        You might as well argue that there's no reason to use strict with a specific piece of code because there are no stricture violations.

      No. That is what padre scripts default to if new scripts are made ... Sometimes i forget to remove it ... http://padre.perlide.org