http://qs1969.pair.com?node_id=513816


in reply to Script to input IP Address and Subnet Bits (10.3.2.0/28)

You might want to look at Data::Validate::IP
  • Comment on Re: Script to input IP Address and Subnet Bits (10.3.2.0/28)

Replies are listed 'Best First'.
Re^2: Script to input IP Address and Subnet Bits (10.3.2.0/28)
by ikegami (Patriarch) on Dec 03, 2005 at 17:33 UTC
    It doesn't check for range, so you can do:
    use Data::Validate::IP qw(is_ipv4); my $ip_w_mask = '10.3.2.0/28'; my ($ip, $mask) = m{^(.*)/(\d+)$} or die("Incorrect format: Mask not found\n"); is_ipv4($ip) or die("Incorrect format: Malformed IP address\n");