#!/usr/local/bin/perl

srand(time|$$) ;

$test_names = shift ;
open ( G, $test_names ) || die "Could not open $test_names" ;
while ($fn=<G>) {
  print &pick_one ;
  print ".\n" ;
}
exit ;

sub pick_one {
   
   open ( F, $fn ) || die "Could not open $fn" ;
   # amass questions into a vector
   $question = 0 ;
   $qt[0] = "" ;
   while($line = <F>) {
      $line =~ /^ *$/ && last ;
      if ($line =~ /^\./){ 
         $question++ ;
         $qt[$question] = "" ;
      }
      else {
         $qt[$question] .= $line ;
      }
   }
   close F ;
   $pick_me = int(rand($question)) ;
   $qt[$pick_me] ;
}

