http://www.perlmonks.org?node_id=881325


in reply to How to use Threads

Your operating system is already multithreaded. Your task would be easier suited to using that than the in-language thread support:

opendir(DIR, $directoryLocation); my @files = grep(/\.html$/,readdir(DIR)); closedir(DIR); my @cmd = qw( start perl c:/html2wordxml.pl ); foreach my $file ( @files ) { system( @cmd => $file ); }

In other words, make a program that knows how to reformat a single file, and then call that program repeatedly without waiting for the last call to finish.