in reply to Re^2: Integer IP address to Quad IPv4 address one liner or close to it?
in thread Integer IP address to Quad IPv4 address one liner or close to it?

You should probably use the functions in Socket who's names I can never remember, but this works for the dotted decimal form:

print unpack 'N', pack 'C4', split '\.', '127.0.0.1';; 2130706433

It doesn't work for those obscure forms that only hackers and scammers use: dotted-hex & dotted-octal.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
RIP PCW
  • Comment on Re^3: Integer IP address to Quad IPv4 address one liner or close to it?
  • Download Code