sub prefix_to_mask { my ($bits) = @_; return inet_ntoa(pack('N', (2**32) - (2**(32-$bits)))); }