c has asked for the wisdom of the Perl Monks concerning the following question:
my $versionFile = '/usr/local/AppName/version'; open(FH,$versionFile) or warn "No version file"; my $version = <FH>; $version =~ s/\.//g; if $version > 140 { ... }
Generally the App versions were in the format x.y.z, however I've found a few systems runninig x.y.zz meaning that these versions may appear "newer" when compared through my process (e.g. 1.4.10 would be greater than 1.6.0).
What would be the better way of achieving this comparison? When I just try comparing the two directly, I receive an error saying that comparison is not numeric.
-c
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Comparing decimal values
by broquaint (Abbot) on Jan 21, 2003 at 15:55 UTC | |
Re: Comparing decimal values
by blokhead (Monsignor) on Jan 21, 2003 at 15:42 UTC | |
Re: Comparing decimal values
by Hofmator (Curate) on Jan 21, 2003 at 16:26 UTC | |
Re: Comparing decimal values
by Molt (Chaplain) on Jan 21, 2003 at 16:26 UTC | |
Re: Comparing decimal values
by BrowserUk (Patriarch) on Jan 21, 2003 at 17:17 UTC |