use NetAddr::IP; my $sub6 = new NetAddr::IP '2001:db8::/40'; my $i=1; while ($sub6 < $sub6->broadcast) { # should've been <= but it does not seem to work if ($i==4722366482869645213696) { # that many addresses in a /56 print "ip = $sub6\n"; $i=1; } $sub6 ++; $i++; } print "ip = $sub6\n"; # need to print last address