in reply to Next subnet

Try another way of expressing the range. Off the top of my head, something like

#!/usr/bin/env perl use warnings; use strict; use Net::IP; my $ip = new Net::IP ('192.168.0/23') || die ; # Loop do { print $ip->ip(), "\n"; } while (++$ip);

where the prefix is bumped up in this case to /23.

Replies are listed 'Best First'.
Re^2: Next subnet
by jakeease (Friar) on May 26, 2013 at 08:08 UTC

    or this:

    #!/usr/bin/env perl use warnings; use strict; use Net::IP; my $ip = new Net::IP ('192.168.0.0 - 192.168.3.255' ) || die ; # Loop do { print $ip->ip(), "\n"; } while (++$ip);

    Same example, different range; here it crosses two byte boundaries.

    #!/usr/bin/env perl use warnings; use strict; use Net::IP; my $ip = new Net::IP ('10.168.254.0 - 10.169.1.255' ) || die ; # Loop do { print $ip->ip(), "\n"; } while (++$ip);