in reply to simultaneous external script execution
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.
|
|---|