What is the difference between for & foreach, exec &
system?

Answer Posted / ramesh

Both Perl's exec() function and system() function execute a
system shell command. The big difference is that system()
creates a fork process and waits to see if the command
succeeds or fails - returning a value. exec() does not
return anything, it simply executes the command. Neither of
these commands should be used to capture the output of a
system call. If your goal is to capture output, you should
use the

$result = system(PROGRAM);
exec(PROGRAM);

Is This Answer Correct ?    12 Yes 11 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does this symbol mean '->'?

525


Write a program to decode the data in the form using cgi programming

537


How to replace perl array elements?

524


How can I display all array element in which each element will display on next line in perl ?

473


Write syntax to add two arrays together in perl?

534






How do I replace every TAB character in a file with a comma?

541


Explain goto label, goto name, and goto expr?

546


You want to download the contents of a url with perl. How would you do that?

498


You want to add two arrays together. How would you do that?

474


How will you declare a variable in perl?

535


Explain the default scope of variables in perl?

504


What does delete function do in perl?

509


Explain chop?

530


How can I implement the function overloading in Perl ? I read about the operator overloading, I do not know how to implement the function overloading. Thanks in advance ?

2492


How the interpreter is used in Perl?

527