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
What is the use of command “use strict”?
Why to use perl?
Which feature of perl provides code reusability?
What does a die() function do in perl?
How many data types are there in perl?
What are the different string manipulation operators in perl?
Explain regular expression in perl?
Why aren't Perl's patterns regular expressions?
How can you call a subroutine and identify a subroutine?
How to get help for perl?
Perl regular expressions are greedy" what does this mean?
Explain '->' in perl?
How to replace perl array elements?
How to determine strings length in perl?
What does `new $cur->{LINK}' do? (Assume the current package has no new() function of its own.)