in reply to Re: Re: Sorting a hash of IP addresses?
in thread Sorting a hash of IP addresses?
In general it makes sense to push the complexity into the transformation since it is only done once for each element in the list.
Something like: (warning untested)
* I borrowed the ip => dotless conversion from Fletch's golf entrymy @sorted_keys = map {$_->[0]} sort {$a->[1] <=> $b->[1]} map { [ $_, unpack("N",pack("C4",split(/\./,$_))) ] + } keys %ip;
-Blake
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: Sorting a hash of IP addresses?
by davorg (Chancellor) on Dec 05, 2001 at 16:32 UTC |