#Read a file, print its line to the screen. 
$input_file = "sample.txt";
$output_file = "sample-output.txt";

open (INFILE, $input_file) or die "The file $input_file couldn't be found\n";
open (OUTFILE, ">$output_file") or die "The file $output_file couldn't be written\n";

# Loop, continuing as long as a line can be read successfully from the file
while ($line = <INFILE>)        
{
  $line_count++;    
  printf OUTFILE "$line_count  $line";
}

close INFILE;
close OUTFILE;
