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
Why aren't Perl's patterns regular expressions?
What is the use of command “use strict”?
How many types of operators are used in the Perl?
What does last statement do in perl?
What happens in dereferencing?
What is the importance of perl warnings? How do you turn them on?
How can the user execute a long command repeatedly without typing it again and again?
How do you set environment variables in perl?
How to close a directory in perl?
What does next statement do in perl?
Explain goto label?
Which of these is a difference between Perl and C++ ?
In CPAN module, name an instance you use.
What happens when you return a reference to a private variable?
How many data types are there in perl?