I want to use Perl 5.14 (ActiveState ActivePerl) to manage many thousands of executions of an external command-line utility under Microsoft Windows, each with a different argument. If I run them in sequence in a simple loop, they'll take too long to finish, so I want to run them in parallel as well as in an ordered sequence, n at a time (where the optimum value of n is probably going to be 20). I've never done this kind of job control before using Perl, so I need help getting started. Before now, I've used both tricks with the start command in funky systems of batch files and the nifty Unix xargs utility under both the MKS Toolkit and Cygwin. Now, for several important reasons, I need to use Perl instead.

So let's say I want to run a command-line utility named doit.exe 10,000 times on the arguments toit0000, toit0001, toit0002, …, toit9999. I want to invoke the jobs generally in that order, but I want to run them in parallel, 20 at a time. How do I do this in Perl? Assume I have a simple array of the ordered arguments; for example:  my @ordered_arguments = <DATA>; chomp @ordered_arguments;.

Jim


In reply to Using Perl to run a Windows command-line utility many times with ordered, parallel execution by Jim

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.