#!/usr/bin/perl5 

#This is used for generating the html file according to the appropriate
#  template.  It is called BY "generatehtml.pl"

#It is called with two arguments:  the first is the id number and the
# second is the name of the template file.
 
($idnum, $sport) = @ARGV;

open (INFILE, "newstemplate.htm") || die "Could not open file $file \n";


$idnumhtm = $idnum . ".htm";
$output = $idnumhtm;

$headline = "We whipped them good!!";
$text = "Tonight marked the turning point in the history of women's
soccer at Transylvania University.  The stunned crowd could not believe
that the Lady Pioneers were actually beating the University of Waddy
Lady Warriors.
<p>
The field, admittedly was slanted toward the opposing team's goal, but surely
that did not play a role in the outcome of the game.";

$stats = "This is where the stats will go.  Yes it is.  It really is.";
open (OUTFILE, ">$output") || die "Could not open file $output \n";

@lines = <INFILE>;
foreach $line (@lines)
{
  $line =~ s/#SPORT/$sport/ ;
  $line =~ s/#HEADLINE/$headline/ ;
  $line =~ s/#TEXT/$text/ ;
  $line =~ s/#STATS/$stats/ ;
  print OUTFILE $line;
}

close(INFILE);
close(OUTFILE);
