my $ip = NetAddr::IP->new('10.2.9.0/29'); $ip++; # skip network address $ip++; # skip presumed gateway address while( $ip < $ip->broadcast ){ my $iponly = (split '/', $ip++)[0]; #get part before first /, then increment the ip print "$iponly\n"; }