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
How do you turn on the perl warnings?
How to add elements in a hash in perl?
Explain the use of 'my' keyword in perl?
What are some common methods to all handles in perl?
Explain the default scope of variables in perl?
What are scalars?
Which functions in perl allows you to include a module file. State their differences.
Write a program to decode the data in the form using cgi programming
explain the various functions/directives in perl that allow you to include/import a module. Also, state the differences between them.
What are the advantages and disadvantages of perl language?
Create a function that is only available inside the scope where it is defined ?
How to close a directory in perl?
How can you replace the characters from a string and save the number of replacements?
What does -> symbol indicates in Perl?
What is hash?