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
Which of these is a difference between Perl and C++ ?
Explain perl. When do you use perl for programming? What are the advantages of programming in perl?
How to read multi lines from a file in perl?
Explain lists ?
Why Perl aliases are considered to be faster than references?
Mention the difference between die and exit in Perl?
Explain the meaning of closure in perl.
What does a die() function do in perl?
What is the difference between use and require in perl?
How to create a package?
Explain the meaning of perl one-liner?
What happens to objects lost in "unreachable" memory, such as the object returned by Ob->new() in `{ my $ap; $ap = [ Ob->new(), $ap ]; }' ?
What is qq (double q)operator in perl?
What are the different ways to run cgi?
What does this symbol mean '->'?