in reply to Need a better way to break out a range of addresses...

The easy way: use Net::IP.
  • Comment on Re: Need a better way to break out a range of addresses...

Replies are listed 'Best First'.
Re^2: Need a better way to break out a range of addresses...
by Fletch (Bishop) on Mar 28, 2007 at 19:57 UTC

    While that module does work with ranges of addresses ('20.34.101.207 - 201.3.9.99' is the example in its documentation), doesn't look to deal with the syntax the OP is dealing with (with embedded ranges for the separate octets).

    DB<1> x Net::IP->new( "10.0.2.3-5" ) empty array + DB<2> x Net::IP->new( "10.0.2.3-10.0.2.5" ) 0 Net::IP=HASH(0x198db00) 'binip' => 00001010000000000000001000000011 'ip' => '10.0.2.3' 'ipversion' => 4 'is_prefix' => 0 'last_bin' => 00001010000000000000001000000101 'last_ip' => '10.0.2.5'
      True, and perhaps I should have elaborated as did grinder in the tentative solution presented below.