COP 3344-01 Introduction to Unix: Lecture 10
Learning objectives
After this class, you should be able to:
- Write Perl scripts using the following features: (i) arrays, (ii) command line arguments, (iii) file I/O, (iv)
 split, (v)system, and (vi)while.
Reading assignment
- JEA: section 35.12-35.16, 15.19.
 - Lecture slides: Lecture 10.
 Exercises and review questions
- Questions on current lecture's material
 
- Write a Perl script called
 mycp1that takes two command line arguments. A call to./mycp1 file1 file2should copyfile1tofile2. Do not use thesystemcall.- Write a Perl script called
 mycp2that takes two command line arguments. A call to./mycp2 file1 file2should copyfile1tofile2usingsystemand thecpcommand.- Write a Perl script called
 fieldthat takes three command line arguments. A call to./field file linenum wordnumshould output thewordnumth word on thelinenumth line in the filefile. For example,./field file1 5 6should print the 6 th word in the 5 th line of the filefile1. (The words and lines should be numbered starting at 1, and not at 0.) Do not use thesystemcall.- Questions on next lecture's material
 
- Use
 printenvto list all your environment variables.