Hmmm, yeah I suppose I could have worded the question better and focus more on that.
To give a bigger idea, this is similar to a debugger. It reads in lines from a file and executes them. I have a foreach loop going through each line of the file, doing some work on it, and continuing. I have a button (Perl/Tk) that, ideally, will halt the process, and when clicked again it continues the process. This needs to be non-blocking, as there are several other processes running at the same time. Outside of the foreach loop, a number of things could be done that pertain to the full program so I feel it's arbitrary, but the file that is being executed should pause on the current line.
So, for example, say the file contains:
--------------

print "Abc\n"; print "123\n"; print "I'm in a loop\n"; ...
etc. etc.
The goal is to loop it through, executing those commands and doing some other operations (this is already implemented), and when I click the "Halt" button, it'll pause while the rest of the program continues it's normal operations. When I hit the button again, it'll continue from where it left off.
Hope that gave a better idea of what I'm trying to accomplish.


In reply to Re^2: Breaking from a foreach loop, returning to position by Anonymous Monk
in thread Breaking from a foreach loop, returning to position by Anonymous Monk

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.