Good input all! Thanks. The comment about stuff not being anchored help me understand why the "throw away the last part of the line" part of the match didn't get the paren following the naive regex pattern (I don't care if it is a valid IP). I had put that '?' non-greedy flag on and with .* an empty string matched. All I had to do was anchor the end with '$'.

That assignement into a list with a capturing /.../ match thing was very interesting. I'm using a goofy while loop to repeatedly capture and the rip off the IP from lines until there is no matching IP pattern, then move on to the next line (while (<>). That assignement using the match looks like I could use it with an array variable on the left and a 'g' on the match to capture all the matching IP's on a given line. I'll try that after coffee.

Thanks again.


In reply to Re^2: This should be simple (updated) by steppnav
in thread This should be simple by steppnav

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.