Calling a Shell script from Perl

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • starlight849
    New Member
    • Jun 2009
    • 82

    Calling a Shell script from Perl

    Hi, I have a shell script that I'm trying to call from perl.. What is the best way to go about this?

    I'm looping through a file in perl, passing a variable to the shell script, doing some stuff in the shell script, then need to return to perl and move on to the next line.

    Any advice would be appreciated..
  • RonB
    Recognized Expert Contributor
    • Jun 2009
    • 589

    #2
    Does the Perl script need to capture any output from the shell script, or just execute it?

    The system function or qx() operator is used to simply execute the script. If you need to capture the output, you'd use the ` ` backticks operator. There are other methods which can be used depending on your exact needs.

    See: perldoc -f system
    Last edited by RonB; Jul 25 '12, 05:39 PM. Reason: Added link to documentation

    Comment

    • starlight849
      New Member
      • Jun 2009
      • 82

      #3
      It needs to simply execute it... Thanks for your response!!

      Comment

      Working...