Different ways of calling a perl script from another

August 27, 2013

Perl has a number of possibilites to execute other scripts / commands:

  • backticks / qx{} When you want to read all the output at once after the program has terminated
  • exec When you wan’t to continue your process as another program — never returns if succesfull
  • system When you are only interested in the success or failure of the command
  • open When you want to pipe information to or from the command
  • do and require Execute another Perl script here. Similar to C’s #include
  • There are modules to do a three-way open so that you have access to STDINSTDOUT and STDERRof the program you executed. See the apropriate parts of perlipc for advanced information.
Advertisements