Did you actually try it?
use NetAddr::IP;
my $n = NetAddr::IP->new( '172.21.3.128/30' );
for my $ip( @{$n->hostenumref} ) {
print "\t", $ip->addr, "\n";
}
produces:
172.21.3.129
172.21.3.130
Which isn't what you asked for your in your requirement.
Comment on Re: Iterating through all IP addresses in a CIDR