My brain needed something brainless to do. So I checked to see if I could translate the unformatted mess in the OP into something I could read and chew on. (Don't count on this ever happening again; see, instead Markup in the Monastery.

The exercise was not terribly productive, as the raw translation (minus my errors in fixup) yielded so many errors that perl -c D:\PMonks\1126473.pl balked at further checking. But the good news was that most of what the check turned up with accounted for by my use of strict and thus were fairly easy to identify. However, what appears as Ln3 below was missing an Open_Paren:

while ($line = <F>) { if ($. == $findline) { ($field1, $field2, $field3, $field4) = split ' +,', $line;

That, alone, is a no-no here. When you post code, cut'n'paste from something that compiles; don't retype (and if that's what you did here, that may be the cause of the missing paren) because retyping invites typos.

That said, there's another deficiency in your code: you tell us that you're now keying off the word "MILLISEC" but you don't specify whether that's -- well, somewhere in the variable headers -- or somewhere in the data AND a reliable number of lines before the data you're trying to extract.

If that latter, of course, roboticus' response, above, is pretty much all you need (assuming you have actual working code. If the former, what's the relationship between the appearance of "MILLISEC" and the location of the data you want? Obviously, we need to know that to help, and the lack of that information points to another possible weakness in your question -- the lack of sample data.

So, this is only a WAG: if "MILLISEC" has a consistent relationship (in lines of separation) to your data, you need only do exactly as advised above; if the relationship is NOT one of lines of separation then your first step has to be finding a quantifiable relationship or finding a different key that is a reliable indicator.


++$anecdote ne $data

check Ln42!


In reply to Re: Finding a line after a keyword by ww
in thread Finding a line after a keyword by mitso874

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.