Continue with installation|y Do you wish to continue|y Press RETURN when ready| license|q Do you agree to the terms of the license agreement|y Enter the installation directory|/xxxx #### open (input, "< QA.txt") while() { chomp; # no newline s/\#.*//; # no comments s/^\s+//; # no leading white space s/\s+$//; # no trailing white next unless length; # anything left? push (@InputArray, $_); } close (input); my (@Question,@Answer); #Call expect to install my $Install = Expect->spawn("./$FileName") ; for($Index = 0; $Index <= $#InputArray; $Index++) { ($Question[$Index],$Answer[$Index]) = split(/\|/,$InputArray[$Index]); } for($Index = 0; $Index <= $#InputArray; $Index++) { unless ($Install->expect(200,'-re',$acQuestion[$Index])) { die ("Error::". $Install->exp_error() . "\n"); } print $Install "$Answer[$Index]"; print $Install "\r"; sleep (2); } #close the expect $Install->hard_close();