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
Explain chop?
What are perl array functions?
How to start perl in interactive mode?
Write a cgi program to show the header part?
What can be done for efficient parameter passing in perl?
What is the importance of perl warnings? How do you turn them on?
Where do we require ‘chomp’ and what does it mean?
How to merge two arrays in perl?
What are the various uses of perl?
What is the difference between single (') and double (") quote in a string in perl?
How do you find the length of an array?
How many types of variable in perl?
How do you you check the return code of a command in perl?
Mention the difference between die and exit in Perl?
Define say() function in perl?