in reply to Parsing IPv4 Addresses and distinguishing Masks
Regexp::Common::net should get you started:
(note the regex is anchored).$ip2 =~ m/^$RE{net}{IPv4}$/;
I'm afraid I can't help you with question 2 - perhaps another monk has an idea.
Update to clarify my response about the subnet mask:
I guess if you were looking for traditional masks you could identify those that start with 255, but knowledge of the networks you're investigating I have a feeling that approach won't be very robust.
|
|---|