<?xml version="1.0" encoding="windows-1252"?>
<node id="25885" title="RE: Sorting a list of IP addresses (aka Why I hate Big O)" created="2000-08-03 00:05:31" updated="2005-07-19 14:08:39">
<type id="11">
note</type>
<author id="22308">
dws</author>
<data>
<field name="doctext">
It doesn't change the O'ness, but this looks like a job for the Orcish maneuver.
&lt;PRE&gt;
my %cache = ();
my @sorted = sort {
        $cache{$a} ||= pack('C4' =&gt; $a =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)/);
        $cache{$b} ||= pack('C4' =&gt; $b =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)/);
        $cache{$a} cmp $cache{$b};
} @unsorted;&lt;/PRE&gt;

</field>
<field name="root_node">
25833</field>
<field name="parent_node">
25833</field>
</data>
</node>
