What is the difference between exec and system?



What is the difference between exec and system?..

Answer / Prashant Kumar Sharma

"system()" forks a child process to run an external command, but the Perl script continues executing. On the other hand, "exec()" replaces the current Perl script with the specified command, effectively ending the Perl script.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More CGI Perl Interview Questions

Write syntax to use grep function?

1 Answers  


What are the various uses of perl?

1 Answers  


What are perl strings?

1 Answers  


Explain subroutine in perl?

1 Answers  


Is there any way to add two arrays together?

1 Answers  


What do you mean by context of a subroutine?

1 Answers  


package MYCALC; use Exporter; our @EXPORT = (); our @ISA = qw(Exporter); our @EXPORT_OK = qw(addition multi); our %EXPORT_TAGS = (DEFAULT => [qw(&addition)],Both => [qw(&addition & +multi)]); sub addition { return $_[0] + $_[1]; } sub multi { return $_[0] * $_[1]; } 1; Program: use strict; use warnings; my @list = qw (2 2); use Module qw(:DEFAULT); print addition(@list),"\n"; Above coding is my module MYCALC and the program which using this module, I have not exported any function using @EXPORT, but I have used the DEFAULT in %EXPORT_TAGS with the function addition, when I call this function from the main it says the error as,

1 Answers  


what is CPAN?

1 Answers  


how to install a package in perl ????

2 Answers  


What are the different types of perl operators?

1 Answers  


What elements of the Perl language could you use to structure your code to allow for maximum re-use and maximum readability?

1 Answers  


Why do you use Perl?

1 Answers  


Categories