Hi
dudley.
I felt compelled to offer a little advice. In your open / close functions, I would include some minor modifications in the event of failure (hardware related, etc.).
open(FILE, $filein) or die "Couldn't open file $filein : $!\n";
close (FILE) or die "Couldn't close file : $!\n";
open (NEW, ">$filein") or die "Couldn't open $filein : $!\n";
close (NEW) or die "Couldn't close file: $!\n";
Even though perl will close filehandles for you, I feel it is unwise to not explicitly check for success / failure.
Hope this helps,
-Katie