Полезная информация

Learning Perl

Learning PerlSearch this book
Previous: 11.6 Changing Defaults for FormatsChapter 11
Next: 12. Directory Access

11.7 Exercises

See Appendix A, Exercise Answers for answers.

  1. Write a program to open the /etc/passwd file by name and print out the username, user ID (number), and real name in formatted columns. Use format and write.

  2. Add a top-of-page format to the previous program. (If your password file is relatively short, you might need to set the pagelength to something like 10 lines so that you can get multiple instances of the top of the page.)

  3. Add a sequentially increasing page number to the top of the page, so that you get page 1, page 2, and so on, in the output.

Previous: 11.6 Changing Defaults for FormatsLearning PerlNext: 12. Directory Access
11.6 Changing Defaults for FormatsBook Index12. Directory Access