sundialsvc4, thank you very much for your review. I don't take anything you said personally at all. I am always happy to get critique on my work, good or bad.

In regards to your comments... I am not on a development team or producing enterprise level code in any way. Most of my scripts are used locally by my team in a very specific one-off scenario. In this case, we were using it to read the output of a tshark command that was always formatted the same way. Had this been something to use repeatedly, there would have been differences... among them fully commented code, sensible variable names (like $currentLine instead of $cl), etc.

That said, I am also not a professional programmer, CS guy, or Perl expert - hence the original post looking for help. Coming into this script, I knew mostly *what* I wanted to do... but the *how* of moving around in a text file back and forth was new to me. So I Googled, read O'Reilly materials, and experimented until I got something that worked. What you don't see here is the 20 lines of "DEBUG: print..." I took back out! (( grin ))

I would be very interested in how a programmer and Perl expert would tackle this. Could I ask you, if you have time, to re-do the algorithm in a "good" way? It would be purely for education...

By the way, I think you're awesome for taking the time to look at my code and provide feedback!!

Cheers!!

ImJustAFriend


In reply to Re^2: Previous Line Matching Issues by ImJustAFriend
in thread Previous Line Matching Issues by ImJustAFriend

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.