I need to generate a list of IP-addresses (IPv4) in Perl. I have start and end addresses, for example 1.1.1.1 and 1.10.20.30. How can I print all the addresses inbetween?
TMTOWTDI:
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; }