in reply to Re: Perl Script to Run other Scripts with proper pauses?
in thread Perl Script to Run other Scripts with proper pauses?

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.

Replies are listed 'Best First'.
Re^3: Perl Script to Run other Scripts with proper pauses?
by Eily (Monsignor) on Jul 05, 2017 at 17:03 UTC

    Thank you for your answer, I did think about the vertical issue with these variables (the caller modifies a variable which is used by the callee), but didn't think about the horizontal problem (variables from one callee not restored for the next).