SYNOPSIS use Regexp::IPvv qw($IPvv_re); $address =~ /^$IPv4_re$/ and print "IPv4 address\n"; DESCRIPTION If you do not use anchor, beware of cases like: "255.255.255.256" =~ /($IPv4_re)/; # true & capture "255.255.255.25" SEE ALSO Regexp::IPv6