http://www.perlmonks.org?node_id=158459


in reply to Check IP with support for CIDR

You can simplify the CIDR mask check:
return unpack ('N', pack ('C4', split /\./, $i) ^ pack ('C4', split /\ +./, $1)) >> 32 - $2;
   MeowChow                                   
               s aamecha.s a..a\u$&owag.print