#!/usr/bin/perl
#Print the following text and read in the input for the first file (to
#read)
print "Please enter the file name you wish to open: ";
$input = <STDIN>;
#Print the following text and read in the input for the output file
print "Please enter t he file name you wish to write to : ";
$output = <STDIN>;
#Open the input and the output, but also give error if not found.
open (FILE, $input) || die("ERROR: Could not open file!!!!!");
open (FILEOUT, ">$output") || die("ERROR: Couldnt find ");
#Read in the content of our first file and replace "test" with "tester"
#- represented by $_
while(<FILE>){
s/test/tester/ig;
#Print the replaced document to the new output set earlier.
print FILEOUT;
print "Success!";
}
close FILE;
close FILEOUT;
exit;