#!/usr/bin/perl #The strict pragma forces varible declaration and some other things use strict; #The warnings pragma enables all warnings use warnings; my $line; my $stext = $ARGV[0]; my $gradebook; my $gradebookdvi; my $wheredot; my $classnum; my $sectionnum; my $semester; my $year; print "Enter 100,112,etc:"; $classnum=; chomp $classnum; print "Enter section number:"; $sectionnum=; chomp $sectionnum; print "Enter the semester (fall/spring/...):"; $semester=; chomp $semester; print "Enter the year:"; $year=; chomp $year; unless (open STEXT, "< $stext") { die "Cannot create $stext: $!"; } $gradebook="ms$classnum-$sectionnum-signin.tex"; $wheredot=rindex($gradebook,"."); $gradebookdvi=substr($gradebook,0,$wheredot) . ".dvi"; unless (open GRADEBOOK, "> $gradebook") { die "Cannot create $gradebook: $!"; } print GRADEBOOK "\\documentclass[11pt]{article}\n\n"; print GRADEBOOK "\\pagestyle{empty}\n"; print GRADEBOOK "\\begin{document}\n\n"; print GRADEBOOK "\\begin{center}\n"; print GRADEBOOK "{\\LARGE Sign In Sheet}\n\\\\\n"; print GRADEBOOK "\\textbf{Course:} MS $classnum \\hfill \\textbf{Section:} $sectionnum \\hfill \\textbf{Semester:} \L\u$semester\E $year\n\n"; print GRADEBOOK "\\large\n"; print GRADEBOOK "\\begin{tabular}{||ll|l||} \\hline \n"; print "Name of student name file: $stext\n"; print "Start processing file.\n"; while (defined($line=)) { print "I see: $line"; chomp($line); if($line =~ m/^\s*(\d+)\s*(\w+), (\w+) (\w*).*$/) { if($4 eq "YY") { print GRADEBOOK " \L\u$2\E & \L\u$3\E & \\hspace{3in} \\\\ \\hline \n"; } else { print GRADEBOOK " \L\u$2\E & \L\u$3\E \L\u$4\E & \\hspace{3in} \\\\ \\hline \n"; } } } print "Finished processing file.\n"; print GRADEBOOK "\\end{tabular}\n"; print GRADEBOOK "\\end{center}"; print GRADEBOOK "\\end{document}"; if(system "latex $gradebook") { die "\nError:LaTeX unable compile $gradebook\n\n"; } if(system "dvipdf $gradebookdvi") { die "\nError:dvipdf unable covert $gradebook\n\n"; } #print GRADEBOOK "";