in reply to serial system executions

According to the documentation for exec:
The "exec" function executes a system command and never returns -- use "system" instead of "exec" if you want it to return.

So, system should run each simple command serially, and wait for each to finish. For example:

use warnings; use strict; system 'sleep 5' and die "ERROR: sleep died\n"; system 'echo hello > foo.txt' and die "ERROR: echo died\n"; system 'cat foo.txt' and die "ERROR: cat died\n";

On my linux system, "sleep" executes, then "echo" then "cat".

Replies are listed 'Best First'.
Re^2: serial system executions
by azaria (Beadle) on May 11, 2008 at 06:16 UTC
    I run on windows for .exe (c++ program), each one of them are long' and does not wait each system(exe_cmd) to the previous. Any solution ? maybe while loop ?