I’ve been working a lot lately with perl, still I dont really know how <,>,>=,=<, ne,gt, etc.. on stringified “numbers”, by “number” I mean something like: ‘1.4.5.6.7.8.0’
correct me If I’m wrong, the following returns true:
if ('1.4.5' > '8.7.8');
because both will be coerced to true (not an empty string).
but, how does ne,gt,etc string operators work on such numbers?
basically I’m trying to compare version numbers consisted of the following form:
1.3.4.0.2
I can make a numerical comparison of each digit, but before, I ranther want to know of the
string comparing operators perform on such strings.
Thanks,
First: Please
use warningsall the time. You would have realized the following at once:Perl v5.9.0 came distributed with version. And this module makes it very easy to compare version numbers: