Process management: system()

How it works

Does exactly the same thing as "exec LIST" except that it waits for the child process to complete. Note that argument processing varies depending on the number of arguments. If there is more than one argument in LIST, or if LIST is an array with more than one value, starts the program given by the first element of the list with arguments given by the rest of the list.

Examples

@args = ("command", "arg1", "arg2");
system(@args) == 0 or die "system @args failed: $?"


$oldPATH = $ENV{"PATH"};
$ENV{"PATH"} = "/bin:/usr/bin:/usr/local/bin:/usr/local/ubin";
system ("ls > /tmp/output");
$ENV{"PATH"} = $oldPath;


Table of Contents.
Previous | Next