#Read a file, print its line to the screen and to a file.
 
$TheFile = "g:\\data\\english\\TomSawyer.txt";
$OutputFile = ">g:\\data\\english\\out.txt";


# We create two "handles" for input and for output...

open (INFILE, $TheFile) or die "The file $TheFile could not be found";
open (OUTFILE, $OutputFile);

# What follows is a "loop" of execution, valid and continuing
# as long as there's anything still in the input handle...

while (<INFILE>)        
{
		# $_ is the default container for 
		# input and output...

            print  $_; 			#default output is to screen           
            print OUTFILE $_;                         

}

					#  close the handles...
close INFILE;
close OUTFILE;













