in reply to Finding the latest available version of a program

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.