It is currently Thu Sep 09, 2010 7:03 am

Threading a for loop in Perl?

Postby bcarroll » Sun Feb 07, 2010 12:09 am

Is it possible to use multiple threads when parsing a for, foreach, etc... loop in Perl? I believe ActivePerl is not multi-threaded, but I have been able to implement threading using some external modules with success. I would like to figure out how to multi-thread a loop to make it execute faster.

Basically what I am doing is...
foreach $stuff (@array_of_stuff){
exececute_subroutine($stuff);
}

The issue is that the exececute_subroutine() subroutine can take several seconds to complete which makes the overall script execution take a long time.
Check out http://applicationbistro.com

Learn to create applications or guide others in the right direction.
bcarroll
 
Posts: 248
Joined: Fri May 09, 2003 7:37 am
Location: At the keyboard, probably writing a Perl script

Return to Programming and Scripting

Who is online

Users browsing this forum: No registered users and 1 guest

cron

User Menu

Login Form