Thanks jwkrahn, I really appreciate the corrections! I have included them in the script and read the section on error variables in perlvar.

Also, my first version used Moose (influenced by the book "Modern Perl"). After looking at the script, and comparing it with the bash scripts, it took more time and resources. I guess that Moose is for larger and more complex projects, so I have rewritten in what I assume is "procedural programming". It has been trivial to have Moose out, transforming the package into a subroutine.

One thing is puzzeling me is the regex. In a file in this format:

Start End Netblock Attacks Name Country email 116.45.99.0 116.45.99.255 24 1799 46.21.150.0 46.21.150.255 24 1708 121.243.146.0 121.243.146.255 24 1446

Applying this regex:

 qr/^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/m

Gives me:

116.45.99.0 46.21.150.0 121.243.146.0

And this regex:

qr/^((\d{1,3}\.){3}\d{1,3})/m

Gimes me:

116.45.99.0 99. 46.21.150.0 150. 121.243.146.0 146.

I would expect the same result.


In reply to Re^4: Create a ipset for blocking networks based on internet sources by mimosinnet
in thread Create a ipset for blocking networks based on internet sources by mimosinnet

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.