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

Is there a reason why you added use 5.006?

Specifying the expected version of Perl 5 syntax is safe... and probably necessary for robust code.

  • Comment on Re^2: Printing largest number in array using loops and if statement
  • Download Code

Replies are listed 'Best First'.
Re^3: Printing largest number in array using loops and if statement
by CountZero (Bishop) on Jan 17, 2010 at 09:13 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.

        Will future versions of Perl change their grammars according to a use Perl x.y.z pragma? That would be a nice trick. But wouldn't that break the present rule that the use Perl x.y.z indicates a minimum version only?

        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

Re^3: Printing largest number in array using loops and if statement
by matze77 (Friar) on Jan 17, 2010 at 08:15 UTC
    No. That is what padre scripts default to if new scripts are made ... Sometimes i forget to remove it ... http://padre.perlide.org