in reply to Running a script from a script and capturing its output

Read perldoc perlipc. Also see perldoc -q capture. There are several ways. The easiest is backticks.
my $return = `path_to_script`;
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.

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

my $pid = open( CHILD, " $command |" ); my $return = <CHILD>;
have the added benefit of giving your the pid of the spawned process, in case you need to manually kill them.

I usually use IPC::Open3, see Reading only STDERR for example.


I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh