Beefy Boxes and Bandwidth Generously Provided by pair Networks vroom
The stupid question is the question not asked
 
PerlMonks  

Re: program to differentitate IPV4 and IPV6 address

by sauoq (Abbot)
on May 21, 2012 at 12:25 UTC ( #971604=note: print w/ replies, xml ) Need Help??


in reply to program to differentitate IPV4 and IPV6 address

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"; }

-sauoq
"My two cents aren't worth a dime.";


Comment on Re: program to differentitate IPV4 and IPV6 address
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://971604]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (10)
As of 2013-05-18 18:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best material for plates (tableware) is:









    Results (394 votes), past polls