1. Home
  2. Computing & Technology
  3. Perl

Perl array exec() and system() function - Quick Tutorial
How to use the exec() and system() function

From , former About.com Guide

exec(PROGRAM);
$result = system(PROGRAM);
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 backtick operator:
$result = `PROGRAM`;
More Perl Quick Tips
Explore Perl
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Perl
  4. Programming Perl
  5. Perl exec function reference - learn how to use Perl's exec() and system() function in this quick tutorial.

©2009 About.com, a part of The New York Times Company.

All rights reserved.