Creation of Multiple threads

How to create a multiple threads on a function ?

my $thrcount = getValueFromPath($testcase,"TestCase/TCount");

which returns a count from an xml , which is loaded in $testcase.

i want create $thrcount of  threads on a function called putdata.

sub putData {

How to create Multiple threads on this function which are equal to $thr count ?

Please advise , i am new to Perl and threading
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

oleberConnect With a Mentor Commented:
Instead of giving you a solution, I suggest you to read

koti688Author Commented:
hi oleber ,

i have read the documentation, but i can able to create one  thread on a function.

when i have a variable count , how to create that many number of threads on this function ? please help
Adam314Connect With a Mentor Commented:

my @all_threads;
for(1..$thrcount) {
    push @all_threads, threads->create(\&putData);

Open in new window

All Courses

From novice to tech pro — start learning today.