Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^4: RFC: Sorting IPv4 addresses

by bv (Friar)
on Oct 07, 2009 at 14:10 UTC ( #799725=note: print w/replies, xml ) Need Help??


in reply to Re^3: RFC: Sorting IPv4 addresses
in thread RFC: Sorting IPv4 addresses

Ah, I see. That was another case of grabbing code from another node without checking enough. This code runs (by my benchmark) 33% faster than the old split_int:

#... split_pack => sub { my @sorted = map { join '.', unpack("CCCC", $_) } sort { $a cmp $b } map { pack("CCCC",split /\./) } @ips; }, #...
print pack("A25",pack("V*",map{1919242272+$_}(34481450,-49737472,6228,0,-285028276,6979,-1380265972)))

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://799725]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2023-12-06 17:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?











    Results (31 votes). Check out past polls.

    Notices?