in reply to Re: Re: Bing made into a cgi perl script
in thread Bing made into a cgi perl script
The validation for "numeric-only" prevents any unwanted host name resolutions, which inet_aton will gladly do for you if you give it even half a chance. Of course, if you want those, by all means, but you might want to use Net::DNS if you expect to do this a lot.use Socket; sub IsValidIP { return $_[0] =~ /^[\d\.]*$/ && inet_aton($_[0]); }
The numbers in the IP address are only for us computationally impaired humans. Internally they are treated as hex, or in this case, 0xC0A80102, which is the 3232235778 version in decimal. The dots just split up the big hex number into smaller ones which are easier to type in and read. 0xC0A8,0x0102 or 0xC0, 0xA8,0x01,0x02 or whatever strikes your fancy, so long as each compontent is composed of full bytes (2 hex digits per byte).3232235778 192.11010306 49320.258 192.168.258 12625921.2 192.43009.2 49320.1.2 192.168.1.2
|
|---|