prgrm prgrm - 2 months ago 5x
Perl Question

Execute next command after the previous command is finished

I need to ZIP and then send some files using FTP. The problem is that PERL executes everything and won't wait for the compression to try to send the ZIP and the script fails.

The script in pseudocode is something like this:

system("/path/to/zip/gzip myfile.txt")
system("/path/to/ftp/ftp put myfile.txt")

dgw dgw

system waits for the command to finish. The only way to change this behaviour is the addition of an ampersand &.


system( '<command> &');

will execute the command and not wait on the command to finish. To wait for the command to finish simply remove the ampersand.

system( '<command>' );