Here's one simple way.

use threads; use threads::shared; my @file1 : shared; my $t1 = async{ my $getfile1 = qq/getS1config.pl/; open (FILE1, "$getfile1 |" ); @file1 = <FILE1>; }; my @file2 : shared; my $t2 = async{ my $getfile2 = qq/getS2config.pl/; open (FILE2, "$getfile2|" ); @file2 = <FILE2>; }; my @file3 : shared; my $t3 = async{ my $getfile3 = qq/getS3config.pl/; open (FILE3, "$getfile3 |" ); @file3 = <FILE3>; }; $_->join for $t1, $t2, $t3; ## Do stuff with the arrays.

Note that assigning single scalars into arrays in order to interpolate those scalars into strings is a very dubious practice. You should also be checking your opens and much else. You will have to use lexical variables to use :share

This is a minimal demonstration that could be much improved.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."

In reply to Re: simultaneous external script execution by BrowserUk
in thread simultaneous external script execution 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.