I'm guessing that it's because you're mixing /x in $re_line with the plain regexp in $re_ip. This worked fine for me:
#!/usr/bin/perl while( <DATA> ){ chomp; my $re_ip = qr/(\d+\.\d+\.\d+\.\d+):\d+/x; # added /x here + my $re_line = qr/ ^ \s* $re_ip \s* -> \s* $re_ip \s* -> \s* $re_ip + /x; my @results = /$re_line/; printf "%-18s %-18s %-18s\n", @results; } __DATA__ 136.1.1.154:33672 -> 64.210.209.51:80 -> 192.168.1.145:80 tcp 65.201.211.176:14664 -> 64.210.209.54:80 -> 192.168.1.78:80 + tcp 67.38.95.86:2116 -> 64.210.209.50:80 -> 192.168.1.103:80 + tcp 198.49.222.246:52469 -> 64.210.209.54:80 -> 192.168.1.79:80 + tcp 193.80.106.152:3781 -> 64.210.209.61:80 -> 192.168.1.81:80 + tcp 67.28.79.24:3248 -> 64.210.209.54:80 -> 192.168.1.79:80 +tcp 128.187.192.39:1218 -> 64.210.209.54:80 -> 192.168.1.78:80 +tcp 128.187.192.39:1209 -> 64.210.209.51:80 -> 192.168.1.144:80 +tcp
--
Love justice; desire mercy.

In reply to Re: Matching IP address continued by strider corinth
in thread Matching IP address continued by ibanix

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.