Hello, I am writing a perl program that has to be able to open 16 files using another program in C (filename is passed by the command line) and wait until all files are completed before continuning the perl program. I have researched online and found fork() and wait(). I have added them into my perl program and they create the process, however they do not wait until all files are completed before continuing. Please help.
#This is just the command to be called in execu
my $inputfile="perloutput";
my $endfile=".txt ";
my $smb="> ";
my $outputfile="output";
my $smb2="&";
while ($index<16)
{
my $testpath="chirp_md5sum ";
$testpath=$testpath.$inputfile.$index.$endfile.$smb.$outputfile.$
+index.$endfile.$smb2;
chomp $testpath;
print ("$testpath \n");
$id=fork();
if($id eq 0)
{
exec ($testpath);
wait();
exit();
}
$index++;
}