#Start Perl..
#!/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 : ";
$input = <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, ">$input") || die("ERROR: Couldnt find ");
#Read in the content of our first file and replace "test" with "tester" - represented by $_
while($record = <FILE>){
$_ = ~ s/ test / tester /g;
#Print the replaced document to the new output set earlier.
print FILEOUT $_;
print "Success!";
}
close FILE;
close FILEOUT;
exit;