I want to run perl threads in an For loop, for example suppose, i create 2 threads each containing an command to execute, once these 2 threads are completed i need to another set of same 2 threads and run it, and this should go on for the number of times i have given as an input to the main script below is the small code snippet
my @threads; #---Making Concurrent OneClick backup commands using threads------#for (my $i=0;$i<=3;$i++) { #-----performing the CHO loops as given by user-------# foreach (@finalOneClickarray) { push @threads, threads->new(\&concurrentBackupCommandsR +ead, $_); } foreach (@threads) { $_->join(); } } sub concurrentBackupCommandsRead() { doing my stuff here......... }
i have tried to put for loop, but it errors out saying Perl exited with active threads: please let me know what am i doing wrong here
In reply to Running perl threads in loop by dvinay
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |