#!/usr/bin/perl -w
# 1p-1
#    VERSION: 1 (9 September 2003)
#    PURPOSE:  Yours to decide
#              One is to figure out how the lines in the Main Program work

############## LIBRARIES AND PRAGMAS ################
  use strict;

###################### FILES ########################

#### OPEN THE BLAST FILE

  my $file_path = 'ps1p-2-data.txt';
  open FILE, "<$file_path" or die "Can't open $file_path: $!\n";

#################### VARIABLES ######################

my $x;                     # mystery variable: you guess its function
my $y;                     # another mystery variable
my $LF = "\n";             # Line feed (like Enter or Return)

################### MAIN PROGRAM ####################

   $x = Read_mystery_variable();
   print $LF, "ORIGINAL:", $LF, $x, $LF, $LF;
   print "Hit any key to continue", $LF;
   <STDIN>;
   $x =~ s/T/U/g;
   $x =~ s/CAGGU.+U..CAG/CAG/g;
   print "MODIFIED:", $LF, $x, $LF;

#################### SUBROUTINES ####################

#### READ_MYSTERY_VARIABLE
# Reads the mystery variable from a file
sub Read_mystery_variable {

   my $text = "";
   my $line = <FILE>;
   while (defined $line) {
      chomp $line;
      $text .= uc($line);
      $line = <FILE>;
   }
   return $text;
}