I have used a great little module called, Sort::Versions a few times. This module has a sub called versioncmp() that takes two version numbers as arguments, and returns -1, 0, or 1, like the 'cmp' operator, depending on which arg it thinks represents the later version number. It seems to belive that "1_5" is greater than "1.5". This may or may not be what you're looking for.

I strongly encourage you to have a look at the POD for the module... on CPAN under Sort::Versions. There are two versions of the module there, so be sure that you're looking at the later one (ironic isn't it?). The POD discusses the comparison algorithm so that you won't have any surprises.

For a simple real world example of this module in use, have a look at Check websites for software version updates (ex. Garmin), where I use the versioncmp() function to determine whether the Garmin website has posted updates for the firmware for my GPS, or its PC-side software. It works great.


Dave


In reply to Re: General version comparison of CPAN modules by davido
in thread General version comparison of CPAN modules by andreas1234567

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.