Use Regexp::IPv6, IPv4, and/or any of several other modules available on CPAN.
use Regexp::IPv6 qw($IPv6_re); use IPv4; my $address = ; # Add your address here. if ($address =~ /^$IPv6_re$/) { print "IPv6\n"; } elsif (IPv4::check_ip($address)) { print "IPv4\n"; } else { print "Neither.\n"; }
In reply to Re: program to differentitate IPV4 and IPV6 address
by sauoq
in thread program to differentitate IPV4 and IPV6 address
by snimmaka
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |