Yes, do is a bit less useful than two different appoaches: modules, and completely separate scripts.

If your child scripts have any code in common with each other, and especially if they can share resources (files, data), it makes sense to write a module for each, and let everything run in equal standing in the same process. If, however, you want each task to really be a separate script, don't risk lefover values leaking over, and have the master invoke each script in a completely separate process.

(You can still share code by using modules if you run separate processes, of course: simply have them use the common code.)

As for duping, you can copy -- dup -- a filehandle over. perlopentut has details. It doesn't finish solving your original problem but it might help; alternatively pg's suggestion might be a better route.


In reply to Re^3: STDOUT and STDIN question by gaal
in thread STDOUT and STDIN question 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.