in reply to Checking for a valid IP number

Another approach, to do the hard job will be
use Data::Validate::IP qw(is_ipv4);
which has also a nice way to validate a domain
use Data::Validate::Domain qw(is_domain);
and email
use Data::Validate::Email qw(is_email);