Calculate netmask in Perl

This is a small code snippet I wrote along time ago for a bigger framework I’ve created. No extra modules are required. It calculates the netmask of a network based on the network address and network bit (CIDR notation). #!/usr/bin/perl use strict; use warnings; sub _calc_netmask { my($subnet) = @_; # e.g.: 10.0.0.0/24 192.168.1.0/16 my($network, […]