my $ip_add = NetAddr::IP->new('20.20.20.1/24'); for (my $ip = 1; $ip<=2000; $ip++) { my $iponly = (split '/', $ip_add)[0]; print "$iponly\n";