by Randal L. Schwartz and Tom Phoenix ISBN 0-596-00132-0 Third Edition, published July 2001. (See

源代码在线查看: ch16_05.htm

软件大小: 999 K
上传用户: yeshuqin
关键词: L. published Schwartz Edition
下载地址: 免注册下载 普通下载 VIP

相关代码

				Exercises (Learning Perl, 3rd Edition)																																																16.5. Exercises								These exercises are all related; it may be helpful to see what the				second and third should do before starting on the first. See Section A.15, "Answers to Chapter 16 Exercises" for answers.																[15] Make a program that will read through the				perlfunc.pod file looking for identifier names				on =item lines (as in the similar exercise at the				end of Chapter 9, "Using Regular Expressions"). The program should write a				database showing the first line number on which				each identifier appears. That is, if fred was				mentioned on lines 23, 29, and 54, the value stored under the key				fred would be 23. (Hint: the special				$. variable gives the line number of the line that				was just read.)												[10] Make a program that will take a Perl function name on the				command line, and report what =item line of the				perlfunc.pod file first mentions that function.				Your program should not have to read through a long file to get this				answer. What should your program do if the function name isn't				found?												[10] (Extra credit exercise.) Modify the program from the previous				exercise so that when the function is found in the database, your				program will launch your favorite pager program to view the				perlfunc.pod file at that line. (Hint: many				programs that can be used for viewing text files work like				less does, with a command line like less				+1234 filename to start viewing				the file at line 1234. Your favorite text editor may also support				this convention, which is also used by more,				pico, vi,				emacs, and view.)																								16.4. Variable-length (Text) Databases17. Some Advanced Perl Techniques																Copyright © 2002 O'Reilly & Associates. All rights reserved.																			

相关资源