>>>>> "DBSMITH" == DBSMITH  <[EMAIL PROTECTED]> writes:

DBSMITH> from what I remember reading and was told as a best practice using exec 
DBSMITH> /.../..../ was recommended over system.  For this reason exec does not 
DBSMITH> create a child and therefore does not have to wait.  the perl process 
DBSMITH> itself runs the command or program.  what are the pros and cons of each?

Well, the difference is whether a goto or a subroutine call will work
for you.

system() creates a kid, makes the kid do the work.  Then you get
to resume doing what you are doing.

exec() sends you to do the work, and there's no returning.

Each has its place and purpose.

If the *very last* thing you're doing is system(), you can probably
replace that with exec(), and it'd be better.  But otherwise, they
are clearly not interchangable.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to