Knowing what OS would help.

So would answers to such questions as

Please read On asking for help and How do I post a question effectively?.

Nonetheless, here's a WAG -- barebones, unelaborated pseudocode for near-"real time" reading -- avoiding many OS specific ways to check what the executable is up to, the possibility (probability?) that the output is formatted as something other than simple text, whether the executable locks the file it's writing in increments, etc.

#!shebang use strict; use warnings; # do ...; # (whatever sets up the call) call executable # (using system, exec, backticks or ....); # First time check for file written by executable if (exists $thefile) { # the file_in_line_13) { readit(); } else { sleep (some amount of time); goto (in some form or another) 18; } sub readit { open '<', EXEOUT, $thefile ; $latest = <EXEOUT>; close EXEOUT; print "$latest \n"; # (to user); recheck(); } sub recheck { my $timesIdential = 1; sleep (time); open '<', EXEOUT, $thefile ; $newlatest = <EXEOUT>; if ( $newlatest ne $latest ) { clearscreen (OS dependant); readit(); } else { $timesIdentical++; if ($timesIdentical = n) { # for some "n" sufficient to convince you # that the executable is done clearscreen; print "Done\n\n" . $newlatest . "\n"; exit(); } } }

As always, the devil is in the details.

Update, given the detail (parallel processing) in the reply below.

Change line 22 to call a sub wherein (given this structure) you'll throw out any prior processing (wasteful and probably NWYW (® "not what you want") and to do your processing (again).

But we still have no idea of how intensive that processing is, nor how time-critical. Each of those will probably make the replacement suggested in the previous paragraph, in the infamous words of a one-time White House spokesman, "inoperative."


In reply to Re: parsing the results of the subroutine in real time by ww
in thread parsing the results of the subroutine in real time by doar4forum

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.