Home | | | Syllabus | | | Schedule | | | Class Notes | | | Assignments |
Assignment goal: To input a file and produce the file's contents based on user selection.
Assignment structure: Write one Perl program that prompts a user for a filename, opens that file (or generates an error), and prompts the user to either display the file, display the start of the file, or display information about the file. Then, execute the user's choice, and present an option for a new file.
Required input and output: User interactive input via keyboard to select a file and actions. Output should be whatever the user selected. Demonstrate each type of functionality in the sample run. User interaction may be by menu, keyword command or other means.
Further work: Optionally, you could implement a pager (akin to more or less to display a program screen by screen. Optionally, you could add other choices to how to display the file (such as the end of the file, like tail, or only the first few characters from each line, like cut). Optionally, let the user enter a string, and only print out lines with that string, like grep
Deliverables: Send email to Prof. Newby with two attachments. First is your Perl program. Second is a plain text file showing a sample run of the program.
Grading: 10 points for required functionality, plus up to 2 points for extra functionality, as follows:
Criterion | Max. Points | Description |
Functionality | 6 | Meets assignment I/O requirements |
Legibility | 2 | Includes comments; neatly written |
Parsimony | 2 | Uses appropriate data structures and syntax; not overly complex or convoluted |
Extra work | 2 | Functionality demonstrating clear understanding beyond the assignment requirements |