here document to automate perl script that call script

I am trying to use a here document to automate testing a perl script however when the perl script hits a

system(perl subscript.pl)

call, input is no longer entered into this subscript.

here is my script

$ cat test.sh
#ksh
for testcase
do
	program <<-EOF | tee -a funcscnlog.log 
	y
	functional
	2
	$testcase
	reload
	keep
	EOF
	cd log
	cp x.log x.$testcase.log
	cd ..
done
$ sh test.sh TC01 TC02 TC03

I don't really want to use expect as I don't want to install anything else on the test system.

while testing this i also found a odd out put from perl

$ cat test.pl
print "infirst ";
my $buffer = <STDIN>;
chomp($buffer);
print $buffer;
print "me";
system("perl runtest.pl");
print "\naftercall ";
my $buffer = <STDIN>;
print $buffer;
print "\n";

$ cat runtest.pl
print "\ninsubtest ";
my $buffer = <STDIN>;
chomp($buffer);
print $buffer;

$ perl test.pl
infirst a

insubtest b
bame
aftercall c
c

$

if you look closly you will see

system("perl runtest.pl");

is run before

print $buffer;
print "me";
	program <<-EOF | tee -a funcscnlog.log 
	y
	functional
	2
	$testcase
	reload
	keep
	EOF

(a) what is the "-" in front of EOF for?

(b) move all the text from "y" to "EOF" to the far left, at the very least the "EOF" must be in the far left column.

the - in front of EOF tells the here doc to ignore any leading whitespace to allow it to be indented for easy looking code. There is no problem with the here document as I use this syntax on numrous other occassions successfully. The problem only occurs when the perl script "program" calls a subscript

apparently it is due to the way perl buffer all 1024 bytes of stdin on the first call leaving it not readable for the rest subsequent calls.

I have replaced the
system("perl runtest.pl");

with

require "runtest.pl";

and all works