Depending on how you're building that hash, you could increment your true value on a per application basis like this:
%apps = ( gcc-3.3 => 3, gcc-3.3.1 => 2, gcc-3.3.2 => 1, gzip-1.2.4a => 1, make-3.79.1 => 1, );
I expect you will be querying your installed apps much more than you will be rebuilding that list. Using this method you could ++ existing keys /^gcc-/ then add your new entry with a value of 1. Then when you want the most recent you just specify => 1 or maybe even the previous version with => 2. Added benefit of not needing to know the actual release number of the previous version and your undef test will continue to work.

In reply to Re: Finding the latest available version of a program by elwarren
in thread Finding the latest available version of a program by tektsu

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.