##
use CGI qw(:standard);
use Expect;
print "Content-type: text/html\n\n";
print "test1\n";
$htpasswd = "/usr/local/apache/bin/htpasswd $htpasswdfile $formuser";
($htpass = Expect->spawn("$htpasswd")) || die "could not spawn program, $!";
print "test2\n";
exit;
####
test1
Content-type: text/html
test1
test2