#!/usr/bin/perl $SLASH = 24; printf "Enter a number or CIDR block size, i.e. 3072 or /24\n"; $lin = readline STDIN; printf "\n\n"; if (length($lin) == 1 ) { printf "You must type either a number of IP addresses or a blocksize\n"; printf "in CIDR notation, i.e. either 3072 or /24 are valid inputs\n"; exit(1); } if (substr($lin,0,1) == "/") { $Numips = 2 ** (32 - substr($lin,1)); printf "%8d / This column is the prefix length as used in CIDR slash notation\n", $SLASH; } else { $Numips = $lin; } $Eighty = .8 * $Numips; $HDR1 = int(exp(.966*log($Numips))); $HDR2 = int(exp(.930*log($Numips))); printf "%8d Num Ips The number of IP addresses in the specified prefix\n", $Numips; printf "%8d 80% Number of IP addresses marking the 80% threshold\n", $Eighty; printf "%8d HDR .966 When the HD Ratio of the block is .966 it refers to this many addresses\n",$HDR1; printf "%8d HDR .930 When the HD Ratio of the block is .930 it refers to this many addresses\n",$HDR2; printf "\n";