As has already been stated, fork is the most likely solution (until perl6 when the threading support will likely finally be intrinsic to the language).

However, please be aware that fork creates subprocesses. These subprocesses are independant of your parent process. Thus, merely setting a value of "$done = 1" in your subprocess will not affect the parent process in any way, shape, or form. Same in the reverse - the parent setting a variable won't affect the child (after the fork occurs). If this is acceptable (the subprocesses don't interact with each other nor with the parent process - e.g., they transform files on disk), then great. If not, then you'll need to also investigate methods of inter-process communication (IPC).

Update: BrowserUk notes using threads. Threads have similar issues to the above issues with fork from what I understand. The method of inter-thread communication in perl is not quite as simple as it is in some other languages, such as Java. All methods available to fork are available, plus sharing variables directly. However, upon reading the threads and threads::shared documentation, I discarded it as too cumbersome (and volatile), although I desperately miss thread usage when programming in perl (compared to other languages).


In reply to Re: Multitasking in Perl by Tanktalus
in thread Multitasking in Perl by Nesh

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.