Chapter 9. Practical exercises

This chapter provides you with some broader exercises to test your new Perl skills. Each exercise requires you to use a mixture of variables, operators, functions, conditional and looping constructs, and regular expressions.

There are no right or wrong answers. Remember, "There's More Than One Way To Do It."

  1. Write a simple menu system where the user is repeatedly asked to choose a message to display or Q to quit.

    1. Consider case-sensitivity

    2. Handle errors cleanly

  2. Write a "chatterbox" program that holds a conversation with the user by matchings patterns in the user's input.

  3. Write a program that gives information about files.

    1. use file test operators

    2. offer to print the file out if it's a text file

    3. how will you cope with files longer than a screenful?