📄 prf2_01.htm
字号:
>Chapter 3, <CITECLASS="chapter">Dates and Times</CITE></A>, demonstrates conversions between numeric and string date formats and using timers. <ACLASS="xref"HREF="ch04_01.htm"TITLE="Arrays">Chapter 4, <CITECLASS="chapter">Arrays</CITE></A>, covers everything relating to list and array manipulation, including finding unique elements in a list, efficiently sorting lists, and randomizing them. <ACLASS="xref"HREF="ch05_01.htm"TITLE="Hashes">Chapter 5, <CITECLASS="chapter">Hashes</CITE></A>, concludes the basics with a demonstration of the most useful data type, the associative array. The chapter shows how to access a hash in insertion order, how to sort a hash by value, and how to have multiple values per key.</P><PCLASS="para"><ACLASS="xref"HREF="ch06_01.htm"TITLE="Pattern Matching">Chapter 6, <CITECLASS="chapter">Pattern Matching</CITE></A>, is by far the largest chapter. Recipes include converting a shell wildcard into a pattern, matching letters or words, matching multiple lines, avoiding greediness, and matching strings that are close to but not exactly what you're looking for. Although this chapter is the longest in the book, it could easily have been longer still - every chapter contains uses of regular expressions. It's part of what makes Perl Perl.</P><PCLASS="para">The next three chapters cover the filesystem. <ACLASS="xref"HREF="ch07_01.htm"TITLE="File Access">Chapter 7, <CITECLASS="chapter">File Access</CITE></A>, shows opening files, locking them for concurrent access, modifying them in place, and storing filehandles in variables. <ACLASS="xref"HREF="ch08_01.htm"TITLE="File Contents">Chapter 8, <CITECLASS="chapter">File Contents</CITE></A>, discusses watching the end of a growing file, reading a particular line from a file, and random access binary I/O. Finally, in <ACLASS="xref"HREF="ch09_01.htm"TITLE="Directories">Chapter 9, <CITECLASS="chapter">Directories</CITE></A>, we show techniques to copy, move, or delete a file, manipulate a file's timestamps, and recursively process all files in a directory.</P><PCLASS="para">Chapters 10 through 13 focus on making your program flexible and powerful. <ACLASS="xref"HREF="ch10_01.htm"TITLE="Subroutines">Chapter 10, <CITECLASS="chapter">Subroutines</CITE></A>, includes recipes on creating persistent local variables, passing parameters by reference, calling functions indirectly, and handling exceptions. <ACLASS="xref"HREF="ch11_01.htm"TITLE="References and Records">Chapter 11, <CITECLASS="chapter">References and Records</CITE></A>, is about data structures; basic manipulation of references to data and functions are demonstrated. Later recipes show how to create record-like data structures and how to save and restore these structures from permanent storage. <ACLASS="xref"HREF="ch12_01.htm"TITLE="Packages, Libraries, and Modules">Chapter 12, <CITECLASS="chapter">Packages, Libraries, and Modules</CITE></A>, concerns breaking up your program into separate files; we discuss how to make variables and functions private to a module, replace built-ins, trap calls to missing modules, and use the <EMCLASS="emphasis">h2ph</EM> and <EMCLASS="emphasis">h2xs</EM> tools to interact with C and C++ code. Lastly, <ACLASS="xref"HREF="ch13_01.htm"TITLE="Classes, Objects, and Ties">Chapter 13, <CITECLASS="chapter">Classes, Objects, and Ties</CITE></A>, covers the fundamentals of building your own object-based module to create user-defined types, complete with constructors, destructors, and inheritance. Other recipes show examples of circular data structures, operator overloading, and tied data types.</P><PCLASS="para">The next two chapters are about interfaces: one to databases, the other to display devices. <ACLASS="xref"HREF="ch14_01.htm"TITLE="Database Access">Chapter 14, <CITECLASS="chapter">Database Access</CITE></A>, includes techniques for manipulating indexed text files, locking DBM files and storing data in them, and a demonstration of Perl's SQL interface. <ACLASS="xref"HREF="ch15_01.htm"TITLE="User Interfaces">Chapter 15, <CITECLASS="chapter">User Interfaces</CITE></A>, covers topics such as clearing the screen, processing command-line switches, single-character input, moving the cursor using <EMCLASS="emphasis">termcap</EM> and <EMCLASS="emphasis">curses</EM>, and platform independent graphical programming using Tk.</P><PCLASS="para">The last quarter of the book is devoted to interacting with other programs and services. <ACLASS="xref"HREF="ch16_01.htm"TITLE="Process Management and Communication">Chapter 16, <CITECLASS="chapter">Process Management and Communication</CITE></A>, is about running other programs and collecting their output, handling zombie processes, named pipes, signal management, and sharing variables between running programs. <ACLASS="xref"HREF="ch17_01.htm"TITLE="Sockets">Chapter 17, <CITECLASS="chapter">Sockets</CITE></A>, shows how to establish stream connections or use datagrams to create low-level networking applications for client-server programming. <ACLASS="xref"HREF="ch18_01.htm"TITLE="Internet Services">Chapter 18, <CITECLASS="chapter">Internet Services</CITE></A>, is about higher-level protocols such as mail, FTP, Usenet news, and Telnet. <ACLASS="xref"HREF="ch19_01.htm"TITLE="CGI Programming">Chapter 19, <CITECLASS="chapter">CGI Programming</CITE></A>, contains recipes for processing web forms, trapping their errors, avoiding shell escapes for security, managing cookies, shopping cart techniques, and saving forms to files or pipes. The final chapter of the book, <ACLASS="xref"HREF="ch20_01.htm"TITLE="Web Automation">Chapter 20, <CITECLASS="chapter">Web Automation</CITE></A><EMCLASS="emphasis">,</EM> covers non-interactive uses of the Web. Recipes include fetching a URL, automating form submissions in a script, extracting URLs from a web page, removing HTML tags, finding fresh or stale links, and processing server log files.</P></DIV></DIV><DIVCLASS="htmlnav"><P></P><HRALIGN="LEFT"WIDTH="684"TITLE="footer"><TABLEWIDTH="684"BORDER="0"CELLSPACING="0"CELLPADDING="0"><TR><TDALIGN="LEFT"VALIGN="TOP"WIDTH="228"><ACLASS="preface"HREF="prf1_01.htm"TITLE="Foreword"><IMGSRC="../gifs/txtpreva.gif"ALT="Previous: Foreword"BORDER="0"></A></TD><TDALIGN="CENTER"VALIGN="TOP"WIDTH="228"><ACLASS="book"HREF="index.htm"TITLE="Perl Cookbook"><IMGSRC="../gifs/txthome.gif"ALT="Perl Cookbook"BORDER="0"></A></TD><TDALIGN="RIGHT"VALIGN="TOP"WIDTH="228"><ACLASS="sect1"HREF="prf2_02.htm"TITLE="Platform Notes"><IMGSRC="../gifs/txtnexta.gif"ALT="Next: Platform Notes"BORDER="0"></A></TD></TR><TR><TDALIGN="LEFT"VALIGN="TOP"WIDTH="228">Foreword</TD><TDALIGN="CENTER"VALIGN="TOP"WIDTH="228"><ACLASS="index"HREF="index/index.htm"TITLE="Book Index"><IMGSRC="../gifs/index.gif"ALT="Book Index"BORDER="0"></A></TD><TDALIGN="RIGHT"VALIGN="TOP"WIDTH="228">Platform Notes</TD></TR></TABLE><HRALIGN="LEFT"WIDTH="684"TITLE="footer"><PCLASS="nav"><FONTSIZE="-1"></P></DIV<!-- LIBRARY NAV BAR --> <img src="../gifs/smnavbar.gif" usemap="#library-map" border="0" alt="Library Navigation Links"><p> <a href="copyrght.htm">Copyright © 2001</a> O'Reilly & Associates. All rights reserved.</font> </p> <map name="library-map"> <area shape="rect" coords="1,0,85,94" href="../index.htm"><area shape="rect" coords="86,1,178,103" href="../lwp/index.htm"><area shape="rect" coords="180,0,265,103" href="../lperl/index.htm"><area shape="rect" coords="267,0,353,105" href="../perlnut/index.htm"><area shape="rect" coords="354,1,446,115" href="../prog/index.htm"><area shape="rect" coords="448,0,526,132" href="../tk/index.htm"><area shape="rect" coords="528,1,615,119" href="../cookbook/index.htm"><area shape="rect" coords="617,0,690,135" href="../pxml/index.htm"></map> </BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -