start page | rating of books | rating of authors | reviews | copyrights

Learning Perl on Win32 Systems

Learning Perl on Win32 SystemsSearch this book
Previous: 15.5 Transliteration Chapter 15
Other Data Transformation
Next: 16. System Information
 

15.6 Exercises

See Appendix A, Exercise Answers for answers.

  1. Write a program to read a list of filenames, breaking each name into its head and tail components. (Everything up to the last backslash is the head, and everything after the last slash is the tail. If there's no backslash, everything is in the tail.) Try this exercise with things like \fred , barney , and fred\barney . Do the results make sense?

  2. Write a program to read in a list of numbers on separate lines, and then sort them numerically, printing out the resulting list in a right-justified column. (Hint: the format to print a right-justified column is something like "%20g" .)

  3. Create a file that consists of sentences, one per line. Write a program that makes the first character of each sentence uppercase, and the rest of the sentence lowercase. (Does the program work even when the first character is not a letter? How would you alter the program if the sentences were not already one per line?)


Previous: 15.5 Transliteration Learning Perl on Win32 Systems Next: 16. System Information
15.5 Transliteration Book Index 16. System Information