#!/usr/bin/perl print "What author?\n"; $auth = <>; chop($auth); print "What title?\n"; $title = <>; chop($title); print "What year?\n"; $year = <>; chop($year); print "What in file?\n"; $infile = <>; chop($infile); open(FILE, "$infile") || die "Can't open $infile"; print "What out file?\n"; $outfile = <>; chop($outfile); open(OUTFILE, ">$outfile") || die "Can't open $outfile"; print "CHAPTER/Chapter/chapter? (1,2,3)\n"; $chap = <>; chop($chap); if ($chap =~ /1/) { $chap = "CHAPTER"; } elsif ($chap =~ /2/) { $chap = "Chapter"; } elsif ($chap =~ /3/) { $chap = "chapter"; } else { $chap = ""; } while () { $_ =~ s/[ ]+/ /g; $_ =~ s|^$chap|\n$auth\n$title\n$year\n|; print OUTFILE $_; } print OUTFILE "\n";