VincentK has asked for the wisdom of the Perl Monks concerning the following question:

Hello everyone. Long time reader, first time poster here.

On my Windows 7 box, when I run the following command , I see that I have PERL version 5.14 installed.

perl -v This is perl 5, version 14, subversion 2 (v5.14.2) built for MSWin +32-x64-multi-thread (with 1 registered patch, see perl -V for more detail) Copyright 1987-2011, Larry Wall Binary build 1402 [295342] provided by ActiveState http://www.Acti +veState.com Built Oct 7 2011 15:19:36
However, when I run the following script without an explicit 'use 5.14;' notation, I receive an error.
use strict; say "sent text via say";
This works
use strict; use v5.14; say "sent text via say";
Within the script if I ask for the version , I receive back '5.014002'. This is not the same as v5.14.2, correct? Or is it?
use strict; print $];
Am I to understand that by default version 5.014002 not 5.14 is being used?

I apologize if I am missing obvious here. Thank you very much.

Replies are listed 'Best First'.
Re: A question about PERL versioning.
by RichardK (Parson) on Oct 09, 2013 at 16:16 UTC

    The help for say says this :-

    This keyword is available only when the "say" feature is enabled, or when prefixed with "CORE::"; see feature. Alternately, include a "use v5.10" or later to the current scope.
Re: A question about PERL versioning.
by ww (Archbishop) on Oct 09, 2013 at 16:16 UTC
    The (non-issue) is that say is one of the (recent) features that remain optional in 5.14 (and in 5.16).

    If you want to use it, put use 5.014; in your header; if not, use print.

Re: A question about PERL versioning.
by VincentK (Beadle) on Oct 09, 2013 at 16:31 UTC

    I think I understand now. My base version is '5.14', but if I need to use optional features of the version, I need to tell PERL to explicity use that version. I didn't realize that 'say' was an optional command. I don't really need to use 'say', I was just confused by the PERL interpreter reporting back that it didn't know what 'say' was without the explicit version call.

    Thank you so much to everyone for the replies and for your patience.

      The say feature was introduced in Perl version 5.10. In order not to break programs written under older versions which might for example use a say function for something else, the say features requires a use pragma such as use 5.10 or use 5.14. This way, older programs continue to work properly, but you can use say in new programs through the use pragma.

      As for versions, 5.14.2 and 5.014002 are just the same, two differents notations for the same version.

      Some of us would be thankful to you if you would use "Perl" (note the case) to refer to the programming language, modules, and use "perl" to refer to the interpreter.
Re: A question about PERL versioning.
by 2teez (Vicar) on Oct 09, 2013 at 19:35 UTC

    Hi VincentK

    Within the script if I ask for the version , I receive back '5.014002'. This is not the same as v5.14.2, correct? Or is it?
    use strict; print $];
    You probably what to check the documentation on $OLD_PERL_VERSION $] and $PERL_VERSION $^V

    If you tell me, I'll forget.
    If you show me, I'll remember.
    if you involve me, I'll understand.
    --- Author unknown to me
Re: A question about PERL versioning.
by Anonymous Monk on Oct 09, 2013 at 15:44 UTC
    same difference.

      I see. Then why do I need to use 'use v5.14' in order for the 'say' statement to work if the base system version is already '5.14'? Thanks.

        required reading: feature, use

        use version implies a certain set of use feature. Specifically, use 5.010 and better enables feature say.

        See "http://compgroups.net/comp.lang.perl.misc/why-can-t-i-use-say-with-version-5.14/2046730".

        I personally would prefer to have features already available without extra effort that are neither experimental nor introduced in current version. Then again this is Perl 5. :-/

Re: A question about PERL versioning.
by VincentK (Beadle) on Oct 10, 2013 at 14:24 UTC

    Many thanks again for all of the feedback! I really appreciate it!

    I think I might just get a copy of "Modern Perl".