in reply to Re: Re: Re: Sorting a hash of IP addresses?
in thread Sorting a hash of IP addresses?

And let's not forget that sorting IP addresses was the canonical example of the packed default sort that Uri Guttman and Larry Rosler used in their most excellent paper on Perl sorting. Changing their code a little gives us this:

@sorted_keys = map substr($_, 4) => sort map pack('C4' => /(\d+)\.(\d+)\.(\d+)\.(\d+)/) . $_ => keys %ip;
--
<http://www.dave.org.uk>

"The first rule of Perl club is you do not talk about Perl club."
-- Chip Salzenberg