title: How to create threads in Perl?
body: <p>I have got easy Perl script where I have got a BIG loop and inside this I invoke more or less million times function <code>my_fun()</code>. I would like to create pool of threads which will be dealing with it - max 5 threads in this same time will be invoking this method in loop.</p>
  
  <p>It is really important for me to use the fastest library - It will be really nice to see examples.</p>
  
  <p>My code looks like this:</p>
  
  <pre><code>for (my $i = 0; $i &lt; 1000000 ; $i++) {
          my_fun();
  }
  </code></pre>
  
  <p>Thank you in advance </p>