open(IN,"crypt.ind.tmp"); $a = ; print OUT "$a\n\\addcontentsline{toc}{chapter}{Index}\n"; while () { print OUT $_; } close OUT; close IN; system("mv -f crypt.ind.tmp crypt.ind");