CIS 33A Programming in PERL
Assignment C

Please staple the assignment together. At the top of the first page print, in this order: your first name, your last name, CIS33A, and the assignment letter. Print the problem number at the beginning of each problem. Assignments are due at the beginning of class, and will be marked down if turned in later.

Authorship note: These assignments have been adapted from assignments given by Clare Nguyen, who adapted them from the work of Behrouz Forouzan.

Programming Problems are to be done on the computer. Hand in your your source code and program output.

Programming problems

Problem C1

Write a program that creates the difference between the two arrays. The result is an array that contains elements that exist in the first array but not in the second.
Test with:

@list1 = ( 1, 2, 3, 4, 5, 6, 7, 8, 9 ) ;
@list2 = ( 3, 5, 7, 11, 13, 15 ) ;

Problem C2

Write a program that counts the number of occurrences of each letter (from A to Z, case doesn't matter) in a text file. The output should look similar to the following:

There are 3 occurrences of the letter A
There are 2 occurrences of the letter B
There are 1 occurrences of the letter C
There are 1 occurrences of the letter D
There are 10 occurrences of the letter E
There are 3 occurrences of the letter F
There are 1 occurrences of the letter G
There are 4 occurrences of the letter H
There are 5 occurrences of the letter I
There are 1 occurrences of the letter J
There are 1 occurrences of the letter K
There are 1 occurrences of the letter L
There are 3 occurrences of the letter M
There are 1 occurrences of the letter N
There are 8 occurrences of the letter O
There are 1 occurrences of the letter P
There are 1 occurrences of the letter Q
There are 3 occurrences of the letter R
There are 7 occurrences of the letter S
There are 10 occurrences of the letter T
There are 2 occurrences of the letter U
There are 1 occurrences of the letter V
There are 4 occurrences of the letter W
There are 1 occurrences of the letter X
There are 1 occurrences of the letter Y
There are 1 occurrences of the letter Z

Test with an input file with the following text:

The quick brown fox jumped over the lazy goose.
It was the best of times, it was the worst of times.