I've been looking for a way to iterate through Ip range and I come across this response
sub inc_ip { $_[0] = pack "N", 1 + unpack "N", $_[0] }
my $start = 1.1.1.1;
my $end = 1.10.20.30;
for ( $ip = $start; $ip le $end; inc_ip($ip) ) {
printf "%vd\n", $ip;
}
What I want to knew is if there is a way to convert string like my $start = "192.168.1.1";
to vector flag. What I get when I pass a string is some random numbers