Efficient sorting of SNMP oids
Richard Foley
Richard.Foley at rfi.net
Sat Oct 31 16:35:05 GMT 2009
Should that be a numerical sort via the spaceship operator?
<=> instead of cmp
--
Richard Foley
Ciao - shorter than aufwiedersehen
http://www.rfi.net/
On Saturday 31 October 2009 17:03:15 B Maqueira wrote:
> Dear all,
>
> I need to sort eficiently a large array (~9000) of SNMP OIDs.
>
> I am currently trying the following code:
>
> my @sorted_oids = map { $_->[0] }
> sort { $a->[1] cmp $b->[1] }
> map { [$_, pack('w*', split(/\./,
> $_))] } @oids;
>
> But this fails since it outputs 1.3.6.1.4.1.2333.3.2.61001.1.10 before
> than 1.3.6.1.4.1.2333.3.2.8080.1.1.1
>
> Any ideas?
>
> _________________________________
> Dr Braudel Maqueira
> braudel at ferrarihaines.com
>
More information about the london.pm
mailing list