Multiple choice technology web technology

In perl , when will you use system and exec command?

  1. (system cmd)When I don’t want to explicitly capture the output and return the control to perl script. (exec cmd) When I want to capture the output and don want to return back to the perl script

  2. (exec cmd)When I don’t want to explicitly capture the output and return the control to perl script. (system cmd) When I want to capture the output and don want to return back to the perl script

  3. (system cmd)When I want to execute system commands only (exec cmd) When I want to execute non system commands only

  4. (exec cmd)When I want to execute system commands only (system cmd) When I want to execute non system commands only

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The system() function executes an external command and returns control to the Perl script after completion, allowing continuation. The exec() function replaces the current Perl process with the external command - the script terminates and doesn't return. Use system() when you want to continue script execution after the command; use exec() when the external command is the final step.