in reply to
I need to write a subnet mask calculator with perl. The extension Net::IP is really powerful.
Well, you could use that module. First thing to do is read its documentation, and off you go. Come back with some code to discuss.
Alternatively I just happen to have a calculator in my toolbox for calculating network, netmask and broadcast out of an IPv4 address in CIDR notation which could be worth being studied by you:
# file cidr
printf"$` network %vd broadcast %vd netmask %vd\n",($z=eval$`)&$m,$z|~
22.214.171.124 network 126.96.36.199 broadcast 188.8.131.52 netm
Consult the perl documentation
for its various operators
, perl special variables
and internal functions