#!/usr/local/bin/perl

$templateFile = "./template_3.tex" ;
# $questionsFile = "./tempfile" ;
$outfile = "./test.tex" ;
$matchString = "SubstituteHere" ;

open(TF, $templateFile ) ;
# open(QF, $questionsFile ) ;
open(OF, ">" . $outfile ) ;

while (<TF>) {
   if ( /$matchString/ ) {
      while ( $l = <> ) {
         if ( $l =~ /^\./ ) { last ; }
         print OF $l ;
      }
   }
   else { print OF $_ ; }
}

