How do I find the next subnet? This should print 192.168.1.0 the second time - it errors:
#!/usr/bin/env perl
use strict;
use warnings;
use Net::IP;
my $ip = Net::IP->new('192.168.0.0/24');
print "Start ip [" . $ip->ip . "]n";
print "start mask [" . $ip->prefixlen . "]n";
$ip->set($ip->last_ip);
$ip++;
$ip->set($ip->ip . "/" . $ip->prefixlen);
print "Start ip [" . $ip->ip . "]n";
print "start mask [" . $ip->prefixlen . "]n";
## ERROR
% ./t2.pl
Start ip [192.168.0.0]
start mask [24]
Can't call method "ip" on an undefined value at ./t2.pl line 15.