in reply to Running a script from a script and capturing its output
If you want more control, like getting stdout separate from stderr, and the ability to use stdin, then IPC::Open3 or IPC::Run, and many other modules are available.my $return = `path_to_script`;
Some programs don't behave well without a real terminal, in those cases you may need to use IO::Pty.
The IPC::Open3 (and similar modules), along with the piped-open
have the added benefit of giving your the pid of the spawned process, in case you need to manually kill them.my $pid = open( CHILD, " $command |" ); my $return = <CHILD>;
I usually use IPC::Open3, see Reading only STDERR for example.
|
|---|