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


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

I prefer to use inet_ntop/inet_pton instead of inet_ntoa/inet_aton. These functions also accept IPv6 addresses, making porting to IPv6 much easier. In fact, with the right functions its not too difficult to write family-independent (IPv4 or IPv6) programs. IPv6 users will thank you.