try it without 192.168.0.1/8, it's invalid and a /8 is huge (2**24).

which is your second problem, in your for loop your forcing all of the individual IPs to be created at once which takes tons of memory and time. you want to read the documentation and use the iterator.

i'm too lazy to look it up at the moment, but it'll be something like:

while ( my $ip = $n->next ) { # do something with ip }

this will only create one IP at a time and be much much faster and use much less memory.

192.168.0.1/8 is invalid. 192.0.0.0/8 would be valid. unless your trying to specify a host and a network at the same time (as on a network interface).

all in all i wouldn't worry about using 192.168.0.1-12 format. i've never seen a need in many years of keeping lists of IPs. most people who have to do whatever with a lot of IPs that can't be constrained into CIDR notation will already have a list with each IP for use with other programs that take IP addresses.


In reply to Re: ip range for config files by zengargoyle
in thread ip range for config files by smackdab

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.