I agree that do might be suitable and have advantages, but for the OP I have to point out some caveats: The code executed by the do will also see package variables from the surrounding scope, and will be sharing globals like $/ with the rest of the code. If one of the scripts sets these variables to something (without properly localizing it), it will affect all the other scripts. This is not the case with system, since it'll be a totally separate process. Here's how one might do that, with appropriatebasic error checking (see $^X, as well as system for how to interpret $?). It would be best if $scriptname were an absolute pathname.

system($^X,$scriptname,@args)==0 or die "$^X $scriptname failed, \$?=$?";

Of course, whether it is a good set-up to have one Perl script call several other scripts, instead of having one script (properly modularized) do it all, might be questionable in the first place.


In reply to Re^2: Perl Script to Run other Scripts with proper pauses? by haukex
in thread Perl Script to Run other Scripts with proper pauses? by adamZ88

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.