- or download this
if ($zip !~ /^\d+(\-\d{4})?$/)
{
$error{zip} = "Invalid postal code.";
}
- or download this
sub valid_ip
{
my $bit = '[01]?\d\d?|2[0-4]\d|25[0-5]';
return $_[0] =~ /^($bit)(\.($bit)){3}/;
}
- or download this
sub valid_ip
{
my $bits = 0;
...
return $bits == 4;
}
- or download this
use Net::IPv6Addr;
sub valid_ipv6
{
return Net::IPv6Addr::ipv6_parse($_[0]);
}