http://www.perlmonks.org?node_id=400903


in reply to exec, system, or backticks

Strange use of your subroutine arguments. none!

Replies are listed 'Best First'.
Re^2: exec, system, or backticks
by tc1364 (Beadle) on Oct 20, 2004 at 16:04 UTC
    OK, can you please explain your comment? I am not being test or anything like that, I just want to know if something can be done better or more efficent... then lets do it! Thanks, Terry.
      I'm studying to the code, trying to work out what is going on. My first comment was just a reaction to trying to find where the subroutine arguments were going and how used. etc.

      I'm not sure about the performance differences between backticks and the system call. I do know you don't want exec because it essentially replaces the script process with the new process of the exec call. There would be no way for your next line to be reached.

      Are you benchmarking the spawning of processes here? What's up? -ben (perlcapt)

      UPDATE:

      I came across this Spawing other programs in Perl which might help. The big difference it useability between backticks and system() is what they return. Backticks return the stdout of the spawned process, and system() returns the exit code. -ben

        Not sure what is meant by benchmarking the spawning of processes, but the only processes that the code is keeping track of is the parent and child processes from the fork. What should I be doing and or benchmarking? -- Code Over View -- When the child process is created it is sent to the sub send_dk or sub send_ip. Both of these sub's do basically the same thing except one is for passing Datakit info to the Expect script ($swbt_dms) and the other passes IP info into the Expect script. The output from the Expect script is evaluated in the sub ck_results and then the code continues in the sub send_dk where depending on the results the child process hits an "exit" command.
        Thank you for your help, I sincerely appreciate it! Terry