Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: inet_aton

by joe++ (Friar)
on Nov 25, 2002 at 12:49 UTC ( [id://215602]=note: print w/replies, xml ) Need Help??


in reply to inet_aton

Some 14 months go by and I do a Super Search...

How about this?

# converts decimal dotted quad string to network ordered long sub dottedquad2long { return unpack('N', inet_aton(shift)); # or # return unpack 'N', pack 'C4', split /\./, shift; # or # my @seg = split(/\./, shift); # return $seg[0]*256**3+$seg[1]*256**2+$seg[2]*256+$seg[3]; }
Shamelessly stolen from IP Manipulation: An Exercise

--
Cheers, Joe

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2024-04-19 02:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found