http://www.perlmonks.org?node_id=961514


in reply to Rewrite Program Using Arrays

Why did you put this useless bit of superstition at the top?
use 5.12.4;
One way to likely make your program faster would be to use an older Perl, like 5.6. But your superstition prevents that.

Replies are listed 'Best First'.
Re^2: Rewrite Program Using Arrays
by chromatic (Archbishop) on Mar 26, 2012 at 00:46 UTC

    How about to document the version of Perl on which he tested it?

      In that case I'd prefer to see that in the documentation or a comment. By "using" a version number you are not merely saying "I've tested this only with this particular version." What you are effectively saying is more like "I believe this will not work with anything older than X."

      If I see "use 5.12.4;" I assume there was something wrong with even 5.12.3, something that prevents the code to work correctly. So probably I would not bother trying to run it under 5.10.x. On the other hand with a comment about the version tested under, I would try it and only if I end up getting an error I'd take the possible version differences into account.

      Jenda
      Enoch was right!
      Enjoy the last years of Rome.

        You're also documenting to Perl what you expect.

        Remember that much of the difficulty of parsing Perl 5 (and enhancing Perl 5) is that you can only guess as to which features of Perl 5 you expect in any given file without an explicit version declaration. Sure, feature enables keywords, but you also get different semantics in 5.12 and 5.14, for example, with the use of unicode_strings.

        With that said, use 5.12.4; has disadvantages compared to use 5.012;.

        Use 5.12.4; is a habit. Nothing more. I usually do use features like `say`...
        --perl.j
Re^2: Rewrite Program Using Arrays
by Anonymous Monk on Mar 25, 2012 at 19:03 UTC

    say/state/switch, duh

      I don't think the OP is using any of them.

        I don't think the OP is using any of them.

        Well sure, but so what? It doesn't make them useless or superstition.