in reply to Don't use 5.6.N

The 'use VERSION' syntax only became available in 5.6

I don't know when it was introduced, but it was before 5.6. For example, it's present in 5.4.5.
(Upd: It was introduced in 5.4.0. )

it uses the dotted-numeric form that older Perl's don't understand

Isn't the syntax deprecated or invalid in future versions too?

older versions of Perl won't even compile it to report a proper error about the perl version.

It seems to me that syntax error at -e line 1, near "use 5.6" has a pretty obvious meaning. That's a poor reason.

Replies are listed 'Best First'.
Re^2: Don't use 5.6.N
by xdg (Monsignor) on Oct 17, 2007 at 18:34 UTC
    I don't know when it was introduced, but it was before 5.6

    You're right. I was fooled by a funny, little quirk:

    $ perl555 -e 'use 5.006' syntax error at -e line 1, at EOF Execution of -e aborted due to compilation errors. $ perl555 -e 'use 5.006;' Perl 5.006 required--this is only version 5.00505, stopped at -e line +1. BEGIN failed--compilation aborted at -e line 1.

    Apparently the semicolon is significant.

    So, the broader point still holds not to use dotted-numerics, even with a semicolon:

    $ perl555 -e 'use 5.6.0;' syntax error at -e line 1, near "use 5.6" Execution of -e aborted due to compilation errors.
    Isn't the syntax deprecated or invalid in future versions too?

    I think you're referring to "v-strings" -- v5.6.0 -- whereas this is some magic in parsing use with ordinary 5.6.0 as some sort of bareword. E.g. (and without the semicolon)

    $ perl562 -e 'use v5.8.0' Perl v5.8.0 required--this is only v5.6.2, stopped at -e line 1. BEGIN failed--compilation aborted at -e line 1. $ perl562 -e 'use 5.8.0' Perl v5.8.0 required--this is only v5.6.2, stopped at -e line 1. BEGIN failed--compilation aborted at -e line 1.

    I don't know if the latter is going away or not.

    -xdg

    Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

      No, it isn't use causing different parsing. 5.8.0 is interpretted as v5.8.0 in versions of Perl that support v-strings. The 'v' is only required if a single dot is used. v5.8 is different from 5.8 (but 5.8.0 is just v5.8.0).

      So the dropping of v-string support should drop the interpretation of 5.8.0 as a v-string whether in a use line or not.

      - tye        

        dropping of v-string support should drop the interpretation of 5.8.0

        Ick. I hope that for 'use' lines that winds up just getting passed as a string to version instead or that some other backwards compatible hack is done.

        -xdg

        Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.