Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^3: Sorting ip addresses quickly

by salva (Canon)
on Nov 24, 2010 at 15:19 UTC ( [id://873469]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Sorting ip addresses quickly
in thread Sorting ip addresses quickly

obviously that doesn't work:
print sort map { s/(\d+)/$1/eg ; $_ } <DATA>; __DATA__ 192.168.6.10 10.10.254.253 10.10.254.3

Replies are listed 'Best First'.
Re^4: Sorting ip addresses quickly
by Anonymous Monk on Nov 24, 2010 at 15:40 UTC
    To make it work you'd need to use something like
    print map { $$_[0] } sort { $$a[1] <=> $$b[1] } map { [ $_, join '', map { sprintf '%03d', $_ } /(\d+)/g ] } <DATA>; __DATA__ 192.168.6.10 10.10.254.253 10.10.254.3
    update: oh look, thats what the root post is about, lol

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (7)
As of 2024-03-28 15:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found