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

Learning Perl on Win32 Systems

Learning Perl on Win32 SystemsSearch this book
Previous: 5.5 Hash Slices Chapter 5
Hashes
Next: 6. Basic I/O
 

5.6 Exercises

See Appendix A, Exercise Answers for answers.

  1. Write a program that reads in a string, then prints that string and its mapped value according to the mapping presented in Table 5.1 .


    Table 5.1: Sample Hash Mapping

    Input

    Output

    red

    apple

    green

    leaves

    blue

    ocean

  2. Write a program that reads a series of words with one word per line until end-of-file, then prints a summary of how many times each word was seen. (For extra challenge, sort the words in ascending ASCII order in the output.)


Previous: 5.5 Hash Slices Learning Perl on Win32 Systems Next: 6. Basic I/O
5.5 Hash Slices Book Index 6. Basic I/O