in reply to Adding an Entire Class B IP Range to an Array
And yet another way . . .
use IO::Socket qw( inet_aton inet_ntoa ); my $start = unpack( "N", inet_aton( "192.168.0.0" ) ); my @addrs; push @addrs, inet_ntoa( pack( "N", $start++ ) ) for 1..(256*256);
Addendum: Net::Netmask also provides methods for generating the nth address in a given CIDR block.
|
|---|