Exercises

1.
Write a script to take a list of names in the format
last, first
and write it out as
first last
2.
Write a script that searches a file for lines that contain an error message. You can assume that all error messages begin with the string “Error:”.
3.
The last line of a typical United States postal address is of the form
City, State zip
Note that the state can be a two-letter abbreviation, or a full state name. The ZIP Code can be nine digits or ZIP+4 (that is, 92126-1234). Write a program that splits these fields apart and prints them individually.
4.
A bug reporting system contains a status log line. The status log line contains an entry for each change made to the bug report. A typical entry looks like
 OPENED by sdo on 19–Aug–00, ...

Get Perl for C Programmers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.