#!/usr/local/bin/perl

$filename="./grades" ;
$tempfile="./tempfile" ;

  system("cp $filename $filename.save") ;
  open(F,$filename) || die "could not open $filename" ;
  open(G,">" . $tempfile) || die
           "could not open temporary file" ;
  while ($line=<F>)  {
     chop $line ;
     $line =~ /:(.*):/ ;
     $name = $1 ;
     printf ("New grade for student: %s\n", $name ) ;
     $n = <> ;
     printf G ("%s%1d:\n", $line, $n ) ;
  }
  rename( $tempfile, $filename ) ;



