#!/usr/local/bin/perl
print "\nThis script will append multiple documents to a single document.\n";
print "\n\nWhat is the file to be written to? ";
$write_file = < STDIN >;
print "\nThe outfile is $write_file";
print "\n\nWhat file is to be processed? ";
$file = < STDIN >;
while($file != "no"){
open(INFILE, $file);
open(OUTFILE, " > > $write_file");
print OUTFILE "\n";
while(< INFILE >){
$aline = $_;
($first, $rest)= split(' ', $aline);
if($first eq $kill_char){
chop ($first);
$aline = $rest;
}
print OUTFILE "\n$aline";
print "\n$aline";
}
print OUTFILE "\n";
print "\nIf you would like to add another file, type the file name at the prompt.\n";
print "\nOtherwise, type -no- to exit\n";
print "Add another file? ";
$file = < STDIN >;
}
close(OUTFILE);
close(INFILE);
|