# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # # Here's a routine to determine which of two oid values comes first. This is # # a bit tricky. We have to split the oid apart on dots, and compare the # # numbers at corresponding positions until we find a pair that differs. It # # might be noted that this routine sorts any strings that consist of integers # # separated by dots. So it works for IP addresses as well as SNMP OIDs. # # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # sub oidorder { local($i,@a,@b); @a = split(/\./,$a); @b = split(/\./,$b); while (@a && @b) { # From comp.lang.perl return $i if ($i = (shift(@a) <=> shift(@b))); } return -1 if @b; # b is longer. return 1 if @a; # a is longer. 0; # They are identical. } 1;