in reply to Perl usage

Looks like someone is transforming one version number format to another one with 2 (shouldn't it be 3?) digits per "dimension".

Run it and show us the result please.

I suppose the revision string is auto generated from outside perl.

Wouldn't be my favorite way of doing it.

Updates
update

¹) There are various version number formats, this reflects one common approach to create a float number.

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!

Replies are listed 'Best First'.
Re^2: Perl usage (version number)
by LanX (Saint) on Nov 22, 2015 at 18:45 UTC
    from perlmod (v5.14)
    # set the version for version checking $VERSION = 1.00; # if using RCS/CVS, this may be preferred $VERSION = sprintf "%d.%03d", q$Revision: 1.1 $ =~ /(\d ++)/g;

    compare CVS revisions

    So its a way to generate a module's $VERSION number from the version control system's revision number.

    ...well...

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)
    Je suis Charlie!

      Ah, yes, right... That shook loose some ancient information, from back when I was using CVS.

      As I recall, CVS has some magic such that $Revision nnn$ will be automatically updated, replacing nnn will the current CVS revision number each time you check the file in.

      The rest of the code is to extract the number from the string $Revision nnn$ and reformat it so that each number (after the first) is displayed as two digits. So $Revision 1.2.3.4.5$ becomes 1.02.03.04.05.

        > So $Revision 1.2.3.4.5$ becomes 1.02.03.04.05.

        well , yes, except it doesn't

        DB<30> p $VERSION = do { my @r = (q$Revision: 1.2.3.4.5 $ =~ /\d+/g) +; sprintf "%d."."%02d" x $#r, @r }; 1.02030405

        That's what I meant with different version formats and potential bug.

        IMHO $VERSION is supposed to be a float which can be compared numerically with < , == and >.

        There is some mention of a version object, but this seems to be restricted to Perl's own Version.

        DB<34> use Data::Dump qw/dd/ DB<35> dd $] 5.016003 DB<36> dd $^V bless({ original => "v5.16.3", qv => 1, version => [5, 16, 3] }, +"version")

        Cheers Rolf
        (addicted to the Perl Programming Language and ☆☆☆☆ :)
        Je suis Charlie!