in reply to Re^3: multi-command sytem call
in thread multi-command sytem call

I am sorry, yes you are right. Maybe "fork" was a bad word to use here. By it's very nature a forked process runs but the parent process continues to run also. The exec() function does overwrite the current process and is apparent in some simple code such as the following:
#!/usr/bin/perl -w use strict; my $results = exec("lt", "-al", "."); print <<END; ########################### \$results \= $results ########################### END
In the above example you will actually see the printed statement appear on the screen following an error message saying that the command "lt" does not exist. When the command or target program does not exist, or the call fails for any other reson is the only time you will get a "return" from exec().
#!/usr/bin/perl -w use strict; my $results = exec("ls", "-al", "."); print <<END; ########################### \$results \= $results ########################### END
Now this code will perform the list (ls) command on a *nix system feeding it "-al" as command line arguiments and "." (current dir) as the target to list. That is all the will appear on the screen and the following print statement will never be executed because the exec() function was successfull and overwrote this current process.

Sorry for any confusion.


www.perlskripts.com