Hello toolic,

Thank you very much for taking the time to reply. I am sorry about the lack of clarity in my post (first time hehe). Also, sorry for the massive prints, I was using them to see which parts of the code were actually executing.

Yes you are correct, I would like to print to STDOUT just the line with john in it.

The exact output I expect is:

root# perl ult_test.pl -v john -h file1.txt john got got

Really all I'm looking for is john got got, the others just let me know the other sections were run. I ran into trouble with having the subroutine 'pars0r' print the else statement for every element/line in the list/array when all I want is the line that contains john

Thank you very much for your time. If I am still unclear at all, please let me know and I will do my best to convey better.

Sluggo


In reply to Re^2: Parsing a file line by line until a certain indice in array by sluggo
in thread Parsing a file line by line until a certain indice in array by sluggo

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.