http://www.perlmonks.org?node_id=719699


in reply to Don't Use Regular Expressions To Parse IP Addresses!

Something seems to be off on the example of dotted quad representation to binary. If you start with the example of 172.31.254.1 you should stick to it. This has the binary representation of 1010 1100 0001 1111 1111 1110 0000 0001 or 2887777793 in radix 10 (unlike 2887726590 as was stated earlier, which in fact corresponds to 172.31.53.254, which is also what the example continues to assume the ip was, for some reason).