1. Write a Perl program to input one paragraph from the keyboard, with multiple sentences and words in it, and print those sentences in which at least one word has the same number of letters as the number of words in the sentence. For example, the sentence “Print this sentence” will not be printed, but the sentence “Print this short sentence” will be printed. The sentences should be printed with two words per line, unless it is the end of the sentence. E.g. If you type
This is a short paragraph. Longer ones are too boring. Are they not?
This would be printed as,
2. a. Write a Perl program that asks a user for a filename, then opens that file and replaces all occurrences of three letter words with TLW and all positive decimal numbers up to 50 only by their word equivalents. E.g. 25 as twenty five.
b. Write a Perl program that looks through /etc/passwd file, for names that occur in other person’s name and prints the full names of those people. Eg Shyam occurs in Shyamlal, so the full names of both Shyam and Shyamlal would be printed out.
3. a. Write a Perl regular expression to test whether a string looks like a valid NITC subject code of any class or branch.
b. Write a Perl program to input a file of “State city” lines given in alphabetical order by states only and produce a second file with lines in format "city belongs to state", ordered in alphabetical order of cities.
4. a. In the file protdom.dat (which will be given to you) is a list of proteins with their PFAM domains, like this
SwisProtID domain1 domain2 ...
. From this list you have to construct the opposite list, ie. a list of proteins that contains a certain domain, like this
Domain SwisProtID SwisProtID SwisProtID ....
Then save the list in domprot.dat. This goal can be achieved in various ways, you should do it by using hash of hashes.
Original content restored by GrandFather