for (0..$#subnets) { # take each subnet and generate the hex out of the subnet divided by 16 # then the remainder my $pair = hexize((int($subnets[$_]/16)),($subnets[$_]%16)); print $pair; } print "\n";