#!/usr/bin/perl
#
# example of file input and output
#

$input_file  = 'input2.txt';
$output_file = 'output.txt';

# open a file for reading
open( INPUT,  "<", $input_file  )
  or die "Oops - couldn't open '$input_file' for reading";

# open (or create) a file for writing
open( OUTPUT, ">",  $output_file ) 
  or die "Oops - couldn't open '$output_file' for writing";

$number = 1;
while ( $number ){
  $number = <INPUT>;                   # Read a line from the file.
  chomp($number);                      # Remove CR or newline, if any.
  print OUTPUT " I read '$number'\n";  # Tell the user what we got.
}

