CS 2204 Lab 11

Your name here (please print):

Your student ID number here:

    In this lab you will construct a few short PERL programs that perform the actions specified below. To begin, you will need to download the following files to your home directory:

    PerlLab1.txt, PerlLab2.txt

  1. (1 point) Read in the file "PerlLab1.txt", print each line of the file to standard output, then close the file.
  2. (2 points) Read in the file "PerlLab1.txt", print to standard output each line containing the string "print me", then close the file.
  3. (2 points) Read in the file "PerlLab1.txt", print to standard output each line which contains the string "print me" and does not contain the string "no print".
  4. (3 points) Read each of the values contained in the array @ARGV. Print each value in the array to standard output as a line. For example, if your script for this exercise is called "PerlProb4.pl", then executing:
          ./PerlProb4.pl This is it!
    generates
            This
            is
            it!
    
  5. (3 points) Read in the file "PerlLab2.txt". Each line contains three numbers seperated by spaces ("\s+"). Split each line into an array. Print the sum of all three numbers for each line.