in reply to Re: Comparing Two Numbers
in thread Comparing Two Numbers

Thanks, unfortunately i am comparing driver version, meaning that the numbers needs to correct. As i am using the code to determine if a driver is installed and or should we be installing a new version

Replies are listed 'Best First'.
Re^3: Comparing Two Numbers
by choroba (Cardinal) on Jan 05, 2021 at 10:07 UTC
    What driver? If it's a Perl module, it got versioning wrong. If it's not, it might use a different versioning rules, which means you can't use Perl's version.

    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
      Its a perl script that i wrote that runs on boot up for a linux machine. It compares the current running Nvidia driver and check against a list if the current nvidia card should be running a new dirver and if it should be update it Its been working find up to now but this is the first time we have had a driver number with more two decimals
Re^3: Comparing Two Numbers
by Ratazong (Monsignor) on Jan 05, 2021 at 11:07 UTC

    Hello abs52

    You could check if your two version strings both contain two dots - and append a ".0" if not (as suggested by choroba). And then use the possibly modified versions for comparision, not the original ones.

    HTH, Rata