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|~
126.96.36.199 network 188.8.131.52 broadcast 184.108.40.206 netm
Consult the perl documentation
for its various operators
, perl special variables
and internal functions