DOC PREVIEW
FSU COP 4342 - COP 4342 Assignment

This preview shows page 1 out of 2 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

COP4342 - 2006 FallAssignment 5Word IndexObjectives: Learn how to use explicit and automatic memory variables,the exists function, the substitution command, the string concatenationoperator, pattern matching, and more experience with hashes, the sort op-erator, and formatted output.Instructions: Your assignment is write to a Perl program called words.plthat reads in text from the diamond operator and writes the words in alpha-betical order to standard output.Each word should consist of two or more characters, start with a letter,and the remaining characters consist of letters, digits, and underscores. Alongwith each word, you should also write the number of times that it occurs andthe line numbers in ascending order on which it was found. Since a wordmay or may not be capitalized, you should convert e ach word encounteredto have lowercase letters only.Consider the following input:#!/usr/bin/perl -wuse strict;# This line will print a hello world line.print "Hello world!\n";exit 0;The output should be formatted as follows: Each line should first containthe word, where each word is printed in a right-justified field that is as wideas the longest word encountered (and not zero-filled, unlike assignment 4.)Afterwards, print a colon and a blank. Next, print the number of timesthat the word was encountered as a four digit right-justified field. Next, print” times, lines: ”. Finally, print the list of line numbers in ascending order1on which the word was encountered. If a word appears on a line more thanonce, then just print the line number once.Below is the output of the program using the input above.bin: 1 times, lines: 1exit: 1 times, lines: 8hello: 2 times, lines: 5, 6line: 2 times, lines: 5perl: 1 times, lines: 1print: 2 times, lines: 5, 6strict: 1 times, lines: 3this: 1 times, lines: 5use: 1 times, lines: 3usr: 1 times, lines: 1will: 1 times, lines: 5world: 2 times, lines: 5, 6Submission: Submit the words.pl Perl program as an attachment inan e-mail message to [email protected] before the beginning of class onWednesday, October


View Full Document

FSU COP 4342 - COP 4342 Assignment

Download COP 4342 Assignment
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view COP 4342 Assignment and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view COP 4342 Assignment 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?