1open(IN,"<crypt.ind");
2open(OUT,">crypt.ind.tmp");
3$a = <IN>;
4print OUT  "$a\n\\addcontentsline{toc}{chapter}{Index}\n";
5while (<IN>) {
6   print OUT $_;
7}
8close OUT;
9close IN;
10system("mv -f crypt.ind.tmp crypt.ind");
11
12