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
In reply to Comparing decimal values by c
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |