in reply to Re: Adding an Entire Class B IP Range to an Array
in thread Adding an Entire Class B IP Range to an Array

Thanks for the tip. Here's how I've accomplished it:
use Net::IP; my $ip = new Net::IP ('192.168.1.1 - 192.168.254.254') || die; do { print $ip->ip(), "\n"; } while (++$ip);
BTW..I haven't seen a do/while loop since my C++ class in college. I wasn't even aware Perl had one.

Replies are listed 'Best First'.
Re^3: Adding an Entire Class B IP Range to an Array
by ikegami (Patriarch) on Mar 31, 2005 at 17:59 UTC

    That program prints '192.168.1.255', '192.168.2.0', etc. Is that what you wanted?

    ... 192.168.1.254 192.168.1.255 192.168.2.0 192.168.2.1 ... 192.168.2.254 192.168.2.255 192.168.3.0 192.168.3.1 ...
      if the op wants to treat an entire class B as one subnet (a mask of 255.255.0.0), the range goes from 192.168.0.0 (net-address) to 192.168.255.255 (broadcast). All other addresses like '192.168.1.255' and '192.168.2.0' are fine.

      update: just read the op again and you're right, the question was only asking for 1 - 254, which looks like he really wants to subnet a class B into class C nets (throwing away two of them).