in reply to redirecting the output of the called script thru calling script

You are looking for IPC (InterProcessCommunication). Read "perldoc perlipc". You have many options..... backticks, piped opens, or my favorite IPC::Open3 ( read perldoc IPC::Open3) and look at this example IPC3 buffer limit problem. A simple bit of code is
#!/usr/bin/perl use warnings; use strict; use IPC::Open3; #interface to "bc" calculator #my $pid = open3(\*WRITE, \*READ, \*ERROR,"bc"); my $pid = open3(\*WRITE, \*READ,0,"bc"); #if \*ERROR is false, STDERR is sent to STDOUT while(1){ print "Enter expression for bc, i.e. 2 + 2\n"; chomp(my $query = <STDIN>); #send query to bc print WRITE "$query\n"; #give bc time to output select(undef,undef,undef,.5); #get the answer from bc chomp(my $answer = <READ>); print "$query = $answer\n"; } waitpid($pid, 1); # It is important to waitpid on your child process, # otherwise zombies could be created.
or more complex
#!/usr/bin/perl # sgifford of perlmonks # The reason for your problem is because you're not using # IO::Select quite right. You're passing a timeout of 0 to # can_read, which asks it to return immediately if there is # no data ready yet. What I think you want to do is create # one IO::Select object with both handles, then ask it to # wait until one or both have something ready to read. # Something like this: # It's only drawback is it only outputs 1 line of bc output # so it errs on something like 234^12345 (which outputs a big number) use warnings; use strict; use IPC::Open3; use IO::Select; #interface to "bc" calculator my $pid = open3(\*WRITE, \*READ,\*ERROR,"bc"); my $sel = new IO::Select(); $sel->add(\*READ); $sel->add(\*ERROR); my($error,$answer)=('',''); while(1){ print "Enter expression for bc, i.e. 2 + 2\n"; chomp(my $query = <STDIN>); #send query to bc print WRITE "$query\n"; foreach my $h ($sel->can_read) { my $buf = ''; if ($h eq \*ERROR) { sysread(ERROR,$buf,4096); if($buf){print "ERROR-> $buf\n"} } else { sysread(READ,$buf,4096); if($buf){print "$query = $buf\n"} } } } waitpid($pid, 1); # It is important to waitpid on your child process, # otherwise zombies could be created.
More examples are out there, just search for them here, or on groups.google.com

I'm not really a human, but I play one on earth. Cogito ergo sum a bum