I am new in perl and seeking for code to do my assignment.I want to compare ip adresses in a given traceroute result that is saved in txt file. i want to see if first and third line and 2nd and 4th line have same ip address or not? I shall be thankful for any help. here is txt file

1 10.0.0.106 (10.0.0.106) 0.495 ms 0.400 ms 0.356 ms 2 10.0.0.57 (10.0.0.57) 0.802 ms 0.714 ms 0.720 ms 3 10.0.0.50 (10.0.0.50) 1.130 ms 1.347 ms 1.301 ms 4 10.0.0.133 (10.0.0.133) 1.662 ms 1.694 ms 1.567 ms

In reply to Comparing lines in txt.file by zakishah

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.