Perl cookbook

918 79 0
Perl cookbook

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com [ Team LiB ] • • • • • Table of Contents Index Reviews Reader Reviews Errata Perl Cookbook, 2nd Edition By Tom Christiansen, Nathan Torkington Publisher: O'Reilly Pub Date: August 2003 ISBN: 0-596-00313-7 Pages: 1000 Find a Perl programmer, and you'll find a copy of Perl Cookbook nearby Perl Cookbook is a comprehensive collection of problems, solutions, and practical examples for anyone programming in Perl The book contains hundreds of rigorously reviewed Perl "recipes" and thousands of examples ranging from brief one-liners to complete applications The second edition of Perl Cookbook has been fully updated for Perl 5.8, with extensive changes for Unicode support, I/O layers, mod_perl, and new technologies that have emerged since the previous edition of the book Recipes have been updated to include the latest modules New recipes have been added to every chapter of the book, and some chapters have almost doubled in size [ Team LiB ] This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com [ Team LiB ] • • • • • Table of Contents Index Reviews Reader Reviews Errata Perl Cookbook, 2nd Edition By Tom Christiansen, Nathan Torkington Publisher: O'Reilly Pub Date: August 2003 ISBN: 0-596-00313-7 Pages: 1000 Copyright Foreword Preface What's in This Book What's New in This Edition Platform Notes Other Books Conventions Used in This Book We'd Like to Hear from You Acknowledgments for the First Edition Acknowledgments for the Second Edition Chapter Strings Introduction Recipe 1.1 Accessing Substrings Recipe 1.2 Establishing a Default Value Recipe 1.3 Exchanging Values Without Using Temporary Variables Recipe 1.4 Converting Between Characters and Values Recipe 1.5 Using Named Unicode Characters Recipe 1.6 Processing a String One Character at a Time Recipe 1.7 Reversing a String by Word or Character Recipe 1.8 Treating Unicode Combined Characters as Single Characters Recipe 1.9 Canonicalizing Strings with Unicode Combined Characters Recipe 1.10 Treating a Unicode String as Octets Recipe 1.11 Expanding and Compressing Tabs This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Recipe 1.12 Recipe 1.13 Recipe 1.14 Recipe 1.15 Recipe 1.16 Recipe 1.17 Recipe 1.18 Recipe 1.19 Recipe 1.20 Recipe 1.21 Recipe 1.22 Recipe 1.23 Recipe 1.24 Expanding Variables in User Input Controlling Case Properly Capitalizing a Title or Headline Interpolating Functions and Expressions Within Strings Indenting Here Documents Reformatting Paragraphs Escaping Characters Trimming Blanks from the Ends of a String Parsing Comma-Separated Data Constant Variables Soundex Matching Program: fixstyle Program: psgrep Chapter Numbers Introduction Recipe 2.1 Checking Whether a String Is a Valid Number Recipe 2.2 Rounding Floating-Point Numbers Recipe 2.3 Comparing Floating-Point Numbers Recipe 2.4 Operating on a Series of Integers Recipe 2.5 Working with Roman Numerals Recipe 2.6 Generating Random Numbers Recipe 2.7 Generating Repeatable Random Number Sequences Recipe 2.8 Making Numbers Even More Random Recipe 2.9 Generating Biased Random Numbers Recipe 2.10 Doing Trigonometry in Degrees, Not Radians Recipe 2.11 Calculating More Trigonometric Functions Recipe 2.12 Taking Logarithms Recipe 2.13 Multiplying Matrices Recipe 2.14 Using Complex Numbers Recipe 2.15 Converting Binary, Octal, and Hexadecimal Numbers Recipe 2.16 Putting Commas in Numbers Recipe 2.17 Printing Correct Plurals Recipe 2.18 Program: Calculating Prime Factors Chapter Dates and Times Introduction Recipe 3.1 Finding Today's Date Recipe 3.2 Converting DMYHMS to Epoch Seconds Recipe 3.3 Converting Epoch Seconds to DMYHMS Recipe 3.4 Adding to or Subtracting from a Date Recipe 3.5 Difference of Two Dates Recipe 3.6 Day in a Week/Month/Year or Week Number Recipe 3.7 Parsing Dates and Times from Strings Recipe 3.8 Printing a Date Recipe 3.9 High-Resolution Timers Recipe 3.10 Short Sleeps Recipe 3.11 Program: hopdelta Chapter Arrays Introduction Recipe 4.1 Specifying a List in Your Program Recipe 4.2 Printing a List with Commas Recipe 4.3 Changing Array Size Recipe 4.4 Implementing a Sparse Array This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Recipe 4.5 Iterating Over an Array Recipe 4.6 Iterating Over an Array by Reference Recipe 4.7 Extracting Unique Elements from a List Recipe 4.8 Finding Elements in One Array but Not Another Recipe 4.9 Computing Union, Intersection, or Difference of Unique Lists Recipe 4.10 Appending One Array to Another Recipe 4.11 Reversing an Array Recipe 4.12 Processing Multiple Elements of an Array Recipe 4.13 Finding the First List Element That Passes a Test Recipe 4.14 Finding All Elements in an Array Matching Certain Criteria Recipe 4.15 Sorting an Array Numerically Recipe 4.16 Sorting a List by Computable Field Recipe 4.17 Implementing a Circular List Recipe 4.18 Randomizing an Array Recipe 4.19 Program: words Recipe 4.20 Program: permute Chapter Hashes Introduction Recipe 5.1 Adding an Element to a Hash Recipe 5.2 Testing for the Presence of a Key in a Hash Recipe 5.3 Creating a Hash with Immutable Keys or Values Recipe 5.4 Deleting from a Hash Recipe 5.5 Traversing a Hash Recipe 5.6 Printing a Hash Recipe 5.7 Retrieving from a Hash in Insertion Order Recipe 5.8 Hashes with Multiple Values per Key Recipe 5.9 Inverting a Hash Recipe 5.10 Sorting a Hash Recipe 5.11 Merging Hashes Recipe 5.12 Finding Common or Different Keys in Two Hashes Recipe 5.13 Hashing References Recipe 5.14 Presizing a Hash Recipe 5.15 Finding the Most Common Anything Recipe 5.16 Representing Relationships Between Data Recipe 5.17 Program: dutree Chapter Pattern Matching Introduction Recipe 6.1 Copying and Substituting Simultaneously Recipe 6.2 Matching Letters Recipe 6.3 Matching Words Recipe 6.4 Commenting Regular Expressions Recipe 6.5 Finding the Nth Occurrence of a Match Recipe 6.6 Matching Within Multiple Lines Recipe 6.7 Reading Records with a Separator Recipe 6.8 Extracting a Range of Lines Recipe 6.9 Matching Shell Globs as Regular Expressions Recipe 6.10 Speeding Up Interpolated Matches Recipe 6.11 Testing for a Valid Pattern Recipe 6.12 Honoring Locale Settings in Regular Expressions Recipe 6.13 Approximate Matching Recipe 6.14 Matching from Where the Last Pattern Left Off Recipe 6.15 Greedy and Non-Greedy Matches This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Recipe 6.16 Recipe 6.17 Recipe 6.18 Recipe 6.19 Recipe 6.20 Recipe 6.21 Recipe 6.22 Recipe 6.23 Detecting Doubled Words Matching Nested Patterns Expressing AND, OR, and NOT in a Single Pattern Matching a Valid Mail Address Matching Abbreviations Program: urlify Program: tcgrep Regular Expression Grab Bag Chapter File Access Introduction Recipe 7.1 Opening a File Recipe 7.2 Opening Files with Unusual Filenames Recipe 7.3 Expanding Tildes in Filenames Recipe 7.4 Making Perl Report Filenames in Error Messages Recipe 7.5 Storing Filehandles into Variables Recipe 7.6 Writing a Subroutine That Takes Filehandles as Built-ins Do Recipe 7.7 Caching Open Output Filehandles Recipe 7.8 Printing to Many Filehandles Simultaneously Recipe 7.9 Opening and Closing File Descriptors by Number Recipe 7.10 Copying Filehandles Recipe 7.11 Creating Temporary Files Recipe 7.12 Storing a File Inside Your Program Text Recipe 7.13 Storing Multiple Files in the DATA Area Recipe 7.14 Writing a Unix-Style Filter Program Recipe 7.15 Modifying a File in Place with a Temporary File Recipe 7.16 Modifying a File in Place with the -i Switch Recipe 7.17 Modifying a File in Place Without a Temporary File Recipe 7.18 Locking a File Recipe 7.19 Flushing Output Recipe 7.20 Doing Non-Blocking I/O Recipe 7.21 Determining the Number of Unread Bytes Recipe 7.22 Reading from Many Filehandles Without Blocking Recipe 7.23 Reading an Entire Line Without Blocking Recipe 7.24 Program: netlock Recipe 7.25 Program: lockarea Chapter File Contents Introduction Recipe 8.1 Reading Lines with Continuation Characters Recipe 8.2 Counting Lines (or Paragraphs or Records) in a File Recipe 8.3 Processing Every Word in a File Recipe 8.4 Reading a File Backward by Line or Paragraph Recipe 8.5 Trailing a Growing File Recipe 8.6 Picking a Random Line from a File Recipe 8.7 Randomizing All Lines Recipe 8.8 Reading a Particular Line in a File Recipe 8.9 Processing Variable-Length Text Fields Recipe 8.10 Removing the Last Line of a File Recipe 8.11 Processing Binary Files Recipe 8.12 Using Random-Access I/O Recipe 8.13 Updating a Random-Access File Recipe 8.14 Reading a String from a Binary File Recipe 8.15 Reading Fixed-Length Records This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Recipe 8.16 Recipe 8.17 Recipe 8.18 Recipe 8.19 Recipe 8.20 Recipe 8.21 Recipe 8.22 Recipe 8.23 Recipe 8.24 Recipe 8.25 Recipe 8.26 Recipe 8.27 Reading Configuration Files Testing a File for Trustworthiness Treating a File as an Array Setting the Default I/O Layers Reading or Writing Unicode from a Filehandle Converting Microsoft Text Files into Unicode Comparing the Contents of Two Files Pretending a String Is a File Program: tailwtmp Program: tctee Program: laston Program: Flat File Indexes Chapter Directories Introduction Recipe 9.1 Getting and Setting Timestamps Recipe 9.2 Deleting a File Recipe 9.3 Copying or Moving a File Recipe 9.4 Recognizing Two Names for the Same File Recipe 9.5 Processing All Files in a Directory Recipe 9.6 Globbing, or Getting a List of Filenames Matching a Pattern Recipe 9.7 Processing All Files in a Directory Recursively Recipe 9.8 Removing a Directory and Its Contents Recipe 9.9 Renaming Files Recipe 9.10 Splitting a Filename into Its Component Parts Recipe 9.11 Working with Symbolic File Permissions Instead of Octal Values Recipe 9.12 Program: symirror Recipe 9.13 Program: lst Chapter 10 Subroutines Introduction Recipe 10.1 Accessing Subroutine Arguments Recipe 10.2 Making Variables Private to a Function Recipe 10.3 Creating Persistent Private Variables Recipe 10.4 Determining Current Function Name Recipe 10.5 Passing Arrays and Hashes by Reference Recipe 10.6 Detecting Return Context Recipe 10.7 Passing by Named Parameter Recipe 10.8 Skipping Selected Return Values Recipe 10.9 Returning More Than One Array or Hash Recipe 10.10 Returning Failure Recipe 10.11 Prototyping Functions Recipe 10.12 Handling Exceptions Recipe 10.13 Saving Global Values Recipe 10.14 Redefining a Function Recipe 10.15 Trapping Undefined Function Calls with AUTOLOAD Recipe 10.16 Nesting Subroutines Recipe 10.17 Writing a Switch Statement Recipe 10.18 Program: Sorting Your Mail Chapter 11 References and Records Introduction Recipe 11.1 Taking References to Arrays Recipe 11.2 Making Hashes of Arrays Recipe 11.3 Taking References to Hashes This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Recipe 11.4 Taking References to Functions Recipe 11.5 Taking References to Scalars Recipe 11.6 Creating Arrays of Scalar References Recipe 11.7 Using Closures Instead of Objects Recipe 11.8 Creating References to Methods Recipe 11.9 Constructing Records Recipe 11.10 Reading and Writing Hash Records to Text Files Recipe 11.11 Printing Data Structures Recipe 11.12 Copying Data Structures Recipe 11.13 Storing Data Structures to Disk Recipe 11.14 Transparently Persistent Data Structures Recipe 11.15 Coping with Circular Data Structures Using Weak References Recipe 11.16 Program: Outlines Recipe 11.17 Program: Binary Trees Chapter 12 Packages, Libraries, and Modules Introduction Recipe 12.1 Defining a Module's Interface Recipe 12.2 Trapping Errors in require or use Recipe 12.3 Delaying use Until Runtime Recipe 12.4 Making Variables Private to a Module Recipe 12.5 Making Functions Private to a Module Recipe 12.6 Determining the Caller's Package Recipe 12.7 Automating Module Cleanup Recipe 12.8 Keeping Your Own Module Directory Recipe 12.9 Preparing a Module for Distribution Recipe 12.10 Speeding Module Loading with SelfLoader Recipe 12.11 Speeding Up Module Loading with Autoloader Recipe 12.12 Overriding Built-in Functions Recipe 12.13 Overriding a Built-in Function in All Packages Recipe 12.14 Reporting Errors and Warnings Like Built-ins Recipe 12.15 Customizing Warnings Recipe 12.16 Referring to Packages Indirectly Recipe 12.17 Using h2ph to Translate C #include Files Recipe 12.18 Using h2xs to Make a Module with C Code Recipe 12.19 Writing Extensions in C with Inline::C Recipe 12.20 Documenting Your Module with Pod Recipe 12.21 Building and Installing a CPAN Module Recipe 12.22 Example: Module Template Recipe 12.23 Program: Finding Versions and Descriptions of Installed Modules Chapter 13 Classes, Objects, and Ties Introduction Recipe 13.1 Constructing an Object Recipe 13.2 Destroying an Object Recipe 13.3 Managing Instance Data Recipe 13.4 Managing Class Data Recipe 13.5 Using Classes as Structs Recipe 13.6 Cloning Constructors Recipe 13.7 Copy Constructors Recipe 13.8 Invoking Methods Indirectly Recipe 13.9 Determining Subclass Membership Recipe 13.10 Writing an Inheritable Class Recipe 13.11 Accessing Overridden Methods This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Recipe 13.12 Recipe 13.13 Recipe 13.14 Recipe 13.15 Generating Attribute Methods Using AUTOLOAD Coping with Circular Data Structures Using Objects Overloading Operators Creating Magic Variables with tie Chapter 14 Database Access Introduction Recipe 14.1 Making and Using a DBM File Recipe 14.2 Emptying a DBM File Recipe 14.3 Converting Between DBM Files Recipe 14.4 Merging DBM Files Recipe 14.5 Sorting Large DBM Files Recipe 14.6 Storing Complex Data in a DBM File Recipe 14.7 Persistent Data Recipe 14.8 Saving Query Results to Excel or CSV Recipe 14.9 Executing an SQL Command Using DBI Recipe 14.10 Escaping Quotes Recipe 14.11 Dealing with Database Errors Recipe 14.12 Repeating Queries Efficiently Recipe 14.13 Building Queries Programmatically Recipe 14.14 Finding the Number of Rows Returned by a Query Recipe 14.15 Using Transactions Recipe 14.16 Viewing Data One Page at a Time Recipe 14.17 Querying a CSV File with SQL Recipe 14.18 Using SQL Without a Database Server Recipe 14.19 Program: ggh—Grep Netscape Global History Chapter 15 Interactivity Introduction Recipe 15.1 Parsing Program Arguments Recipe 15.2 Testing Whether a Program Is Running Interactively Recipe 15.3 Clearing the Screen Recipe 15.4 Determining Terminal or Window Size Recipe 15.5 Changing Text Color Recipe 15.6 Reading Single Characters from the Keyboard Recipe 15.7 Ringing the Terminal Bell Recipe 15.8 Using POSIX termios Recipe 15.9 Checking for Waiting Input Recipe 15.10 Reading Passwords Recipe 15.11 Editing Input Recipe 15.12 Managing the Screen Recipe 15.13 Controlling Another Program with Expect Recipe 15.14 Creating Menus with Tk Recipe 15.15 Creating Dialog Boxes with Tk Recipe 15.16 Responding to Tk Resize Events Recipe 15.17 Removing the DOS Shell Window with Windows Perl/Tk Recipe 15.18 Graphing Data Recipe 15.19 Thumbnailing Images Recipe 15.20 Adding Text to an Image Recipe 15.21 Program: Small termcap Program Recipe 15.22 Program: tkshufflepod Recipe 15.23 Program: graphbox Chapter 16 Process Management and Communication Introduction This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Recipe 16.1 Gathering Output from a Program Recipe 16.2 Running Another Program Recipe 16.3 Replacing the Current Program with a Different One Recipe 16.4 Reading or Writing to Another Program Recipe 16.5 Filtering Your Own Output Recipe 16.6 Preprocessing Input Recipe 16.7 Reading STDERR from a Program Recipe 16.8 Controlling Input and Output of Another Program Recipe 16.9 Controlling the Input, Output, and Error of Another Program Recipe 16.10 Communicating Between Related Processes Recipe 16.11 Making a Process Look Like a File with Named Pipes Recipe 16.12 Sharing Variables in Different Processes Recipe 16.13 Listing Available Signals Recipe 16.14 Sending a Signal Recipe 16.15 Installing a Signal Handler Recipe 16.16 Temporarily Overriding a Signal Handler Recipe 16.17 Writing a Signal Handler Recipe 16.18 Catching Ctrl-C Recipe 16.19 Avoiding Zombie Processes Recipe 16.20 Blocking Signals Recipe 16.21 Timing Out an Operation Recipe 16.22 Turning Signals into Fatal Errors Recipe 16.23 Program: sigrand Chapter 17 Sockets Introduction Recipe 17.1 Writing a TCP Client Recipe 17.2 Writing a TCP Server Recipe 17.3 Communicating over TCP Recipe 17.4 Setting Up a UDP Client Recipe 17.5 Setting Up a UDP Server Recipe 17.6 Using Unix Domain Sockets Recipe 17.7 Identifying the Other End of a Socket Recipe 17.8 Finding Your Own Name and Address Recipe 17.9 Closing a Socket After Forking Recipe 17.10 Writing Bidirectional Clients Recipe 17.11 Forking Servers Recipe 17.12 Pre-Forking Servers Recipe 17.13 Non-Forking Servers Recipe 17.14 Multitasking Server with Threads Recipe 17.15 Writing a Multitasking Server with POE Recipe 17.16 Writing a Multihomed Server Recipe 17.17 Making a Daemon Server Recipe 17.18 Restarting a Server on Demand Recipe 17.19 Managing Multiple Streams of Input Recipe 17.20 Program: backsniff Recipe 17.21 Program: fwdport Chapter 18 Internet Services Introduction Recipe 18.1 Simple DNS Lookups Recipe 18.2 Being an FTP Client Recipe 18.3 Sending Mail Recipe 18.4 Reading and Posting Usenet News Messages This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Recipe 18.5 Reading Mail with POP3 Recipe 18.6 Simulating Telnet from a Program Recipe 18.7 Pinging a Machine Recipe 18.8 Accessing an LDAP Server Recipe 18.9 Sending Attachments in Mail Recipe 18.10 Extracting Attachments from Mail Recipe 18.11 Writing an XML-RPC Server Recipe 18.12 Writing an XML-RPC Client Recipe 18.13 Writing a SOAP Server Recipe 18.14 Writing a SOAP Client Recipe 18.15 Program: rfrm Recipe 18.16 Program: expn and vrfy Chapter 19 CGI Programming Introduction Recipe 19.1 Writing a CGI Script Recipe 19.2 Redirecting Error Messages Recipe 19.3 Fixing a 500 Server Error Recipe 19.4 Writing a Safe CGI Program Recipe 19.5 Executing Commands Without Shell Escapes Recipe 19.6 Formatting Lists and Tables with HTML Shortcuts Recipe 19.7 Redirecting to a Different Location Recipe 19.8 Debugging the Raw HTTP Exchange Recipe 19.9 Managing Cookies Recipe 19.10 Creating Sticky Widgets Recipe 19.11 Writing a Multiscreen CGI Script Recipe 19.12 Saving a Form to a File or Mail Pipe Recipe 19.13 Program: chemiserie Chapter 20 Web Automation Introduction Recipe 20.1 Fetching a URL from a Perl Script Recipe 20.2 Automating Form Submission Recipe 20.3 Extracting URLs Recipe 20.4 Converting ASCII to HTML Recipe 20.5 Converting HTML to ASCII Recipe 20.6 Extracting or Removing HTML Tags Recipe 20.7 Finding Stale Links Recipe 20.8 Finding Fresh Links Recipe 20.9 Using Templates to Generate HTML Recipe 20.10 Mirroring Web Pages Recipe 20.11 Creating a Robot Recipe 20.12 Parsing a Web Server Log File Recipe 20.13 Processing Server Logs Recipe 20.14 Using Cookies Recipe 20.15 Fetching Password-Protected Pages Recipe 20.16 Fetching https:// Web Pages Recipe 20.17 Resuming an HTTP GET Recipe 20.18 Parsing HTML Recipe 20.19 Extracting Table Data Recipe 20.20 Program: htmlsub Recipe 20.21 Program: hrefsub Chapter 21 mod_perl Introduction This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com letters words null-terminated, reading from binary files numeric operators with parsing date and time information in plurals based on numbers processing characters individually psgrep program reformatting paragraphs removing leading or trailing spaces removing or extracting HTML tags reversing elements of substituting specific words text color, changing treating as files Unicode support in Perl treating as octets treating as single characters universal character code StrNum class (example) struct( ) struct_flock( ), lockarea program structs, classes as sub keyword subclasses, determining membership subject, sorting mail by subroutines access arguments built-in, overriding currently running, name of email sorter exception handling localizing nesting passing arrays and hashes by reference passing by named parameter persistent private variables private for modules private variables prototypes for functions return context, detecting return values returning by reference returning failure skipping selected saving global values trapping undefined function calls writing switch statement substitution expanding filenames within strings substr( ) operators to use with pattern matching variables substrings SUPER pseudoclass superclasses 2nd accessing overridden methods This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com surface copies surl script switch construct Switch module switch statement 2nd writing Symbol module Symbol::qualify( ) symbolic links duplicating directory trees to packages symbolic references symirror program symmetric difference Sys::Hostname module Sys::Syslog module syscalls sysopen( ) filehandles non-blocking I/O unusual filenames sysread( ) sysreadline( ) sysseek( ) system calls system( ) running multiple programs shell escapes SysV IPC syswrite( ) [ Team LiB ] This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com [ Team LiB ] [SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Y] [Z] -t command-line option tables, formatting with HTML shortcuts tabs [See whitespace] tags, HTML [See HTML] tailwtmp program taint mode tan( ) tc( ) tcapdemo program tcgrep program TCP protocol communicating over writing clients for writing servers for TCP_NODELAY socket option tctee program tear-off menus tell( ) telnet, simulating from programs tempfile( ) Template Toolkit configuration data structures other templates parameters Perl code plug-ins subroutines syntax template( ) templates HTML HTML::Mason autohandlers configuration dhandlers Mason syntax objects for modules Template Toolkit configuration data structures other templates parameters Perl code plug-ins subroutines syntax temporary files, modifying files with without Term::ANSIColor module Term::Cap module 2nd Term::ReadKey module This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com checking for waiting input determining window size reading from keyboard reading passwords Term::ReadLine module Term::ReadLine::Gnu module terminal [See user interfaces] termios interface text [See also strings][See also strings] adding to images changing color editors, support for Unicode fonts XML as Text::Abbrev module 2nd Text::Balanced module 2nd Text::CSV module Text::CSV_File module Text::Diff module Text::Metaphone module Text::ParseWords module Text::Soundex module Text::Tabs module Text::Template module Text::Wrap module threads.pm tie( ) DBM files emptying making and using Tie::Array module Tie::File module 2nd 3rd files as arrays Tie::Handle module Tie::Hash module Tie::IxHash module Tie::RefHash module Tie::Scalar module TIEARRAY( ) TIEHANDLE( ) TIEHASH( ) TIESCALAR( ) tilde (~), in filenames, expanding time [See date and time values] time zones [See date and time values] time( ) high-res timers Time::gmtime module 2nd Time::HiRes module 2nd Time::Local module 2nd Time::localtime module Time::timelocal module Time::tm module timegm( ) 2nd timelocal( ) 2nd timers, high-resolution timestamps timing out operations Tk toolkit dialog boxes This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com DOS shell window, removing menus resize events tkshufflepod program tkshufflepod program toString( ), XML documents tr/// operator converting case with trailing growing files whitespace, removing transformations, XML trapping undefined function calls traversing hashes tree structures trigonometry operating in degrees vs radians trim( ) truncate( ) tty devices, testing for typed referents typeglobs 2nd assigning references to filehandles with, creating alias for global values [ Team LiB ] This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com [ Team LiB ] [SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Y] [Z] \U string escape \u string escape ualarm( ) uc( ) ucfirst( ) UDP (User Datagram Protocol) writing clients for writing servers for umask values uname( ) unbuffered input/output 2nd 3rd 4th undef( ), compared to delete( ) undefined values underscore (_), file stat cache Unicode character database combined characters, canonicalizing strings with converting Microsoft files to encodings, XML and named characters, using reading and writing from filehandles strings treating as octets treating as single characters Uniform Resource Locators [See URLs] unimport( ) unions of lists computing unique list elements, extracting universal character code UNIVERSAL module Unix domain sockets 2nd I/O layers unix layer 2nd UnixDate( ) unlink( ), removing directories and contents unpack( ) 2nd fixed-length records unread bytes, determining number unshift( ), circular lists updating random-access files uppercase, converting to lowercase URI::Escape module URI::Heuristic module 2nd uri_escape( ) urlify program URLs (Uniform Resource Locators) expanding tildes in filenames external redirection extracting from HTML fetching from Perl scripts putting HTML links around transparently storing information in This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com use autouse pragma use bytes pragma use charnames pragma use constant pragma use lib pragma use locale pragma use operator use overload pragma use pragmas 2nd trapping errors in Usenet news messages User Datagram Protocol [See UDP] user interfaces adding text to images checking for waiting input clearing the screen controlling programs with Expect determining window size dialog boxes, creating with Tk DOS shell window, removing editing input full-screen mode graphing data 2nd managing screen manipulating terminal directly menus, creating with Tk multiscreen CGI scripts reading from keyboard reading passwords without echo ringing terminal bell tcapdemo program testing programs if running interactively text color thumbnailing images Tk resize events User::pwent module userstats program usleep( ) UTF-8 2nd utf8 I/O layer utime( ), timestamps [ Team LiB ] This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com [ Team LiB ] [SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Y] [Z] validation( ) values [See also numbers strings variables][See also numbers strings variables] comma-separated initializing arrays with parsing converting strings between definedness 2nd exchanging between scalar variables false values( ), traversing hashes variable-length text fields variables constants default values for expanding in user input filehandles in functions private for loop (iterator) variables magic, creating persistent private, for subroutines private, for modules private, for subroutines scalars [See scalars] sharing among different processes strings [See strings] $VERSION variable (use pragma) VERSION( ) vertical bar (|) || operator vs or operator separating multiple comparisons ||= (assignment) operator visual bell VRFY command vrfy program [ Team LiB ] This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com [ Team LiB ] [SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Y] [Z] W3C (World Wide Web Consortium) wait( ) waitpid( ) wantarray( ) WARN signal warn( ), dialog box for warnings customizing reporting like built-ins warnings::enabled( ) warnings::register pragma wc program weaken( ) WeakRef module web architecture web automation converting ASCII to and from HTML extracting table data URLs from HTML fetching https:// web pages password-protected pages URLs finding stale or fresh links HTML forms, submitting parsing removing or extracting tags templates text substitutions htmlsub program mirroring web pages resuming HTTP GET robots server logs parsing processing using cookies web browsers [See browsers] web pages https:// modified, links in password-protected web servers log files, Common Log Format logs parsing processing performance, improving web services SOAP client SOAP server XML-RPC server This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com web, references on Week_Number( ) weekearly program weeks [See date and time values] weighted_rand( ) while loop, traversing hashes whitespace deleting leading or trailing expanding and compressing tabs extracting ranges of lines in pod documentation indenting here documents matching within multiple lines words sorted text in columns and sorting du command output whoami( ) whowasi( ) wildcards (shell) for regular expression matching Win32::Console module windows dialog boxes, creating with Tk DOS shell, removing size of, determining 2nd words double, finding fuzzy matching matching abbreviations pattern matching pluralizing, based on numbers processing all in file reversing sorting into columns substitutions for specific text color, changing wrapping paragraph text words program World Wide Web Consortium (W3C) wrapping paragraph text write( ) writing signal handlers XML wtmp file, adding records to [ Team LiB ] This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com [ Team LiB ] [SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Y] [Z] x command (Perl debugger) \X metacharacter x operator /x pattern modifier comments in regular expressions XML (Extensible Markup Language) CDATA comments declaration documents [See XML documents] files, larger than available memory, processing filtering namespaces nested elements parsing into data structures into DOM tree into SAX events paths Perl and, history of processing instructions reasons for success of schemas syntax transformations Unicode encodings validating documents against schemas well-formed documents writing XML declaration XML documents changing elements or text finding elements and text validating against schemas XML Schema XML Stylesheet Language for Transformations [See XSLT] XML-RPC client server XML::LibXML module 2nd finding elements and text in XML documents parsing XML into a DOM tree validating XML against DTD XML::LibXSLT module 2nd XML::Parser module caution against using directly XML::RSS module XML::Sablotron module, XSLT XML::SAX module parsing XML into SAX events XML::SAX modules, parsing XML XML::SAX::Base module XML::SAX::Machines module, filtering XML This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com XML::SAX::ParserFactory module XML::SAX::PurePerl module XML::Simple module writing XML XML::Twig module, processing large XML files XML::Xerces module, validating XML against W3C Schema XML::XSLT module XMLin( ) XMLout( ), writing XML XMLRPC::Lite module 2nd XPath expressions XS interface 2nd XSLT (XML Stylesheet Language for Transformations) processing [ Team LiB ] This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com [ Team LiB ] [SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Y] [Z] years [See date and time values] [ Team LiB ] This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com [ Team LiB ] [SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Y] [Z] zombies avoiding [ Team LiB ] This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Brought to You by Like the book? Buy it! ... http://www .perl. com Neither is this book meant to be a bare-bones introduction for programmers who have never seen Perl before That's what Learning Perl, a kinder and gentler introduction to Perl, ... you might prefer the Learning Perl for Win32 Systems version.) Instead, this is a book for learning more Perl Neither a reference book nor a tutorial book, Perl Cookbook serves as a companion... of Perl for any proprietary modules that may have been included The perlport(1) manpage is a good start; its SEE ALSO section points to perplatform documentation, such as perlmacos(1) and perlvms(1)

Ngày đăng: 26/03/2019, 11:13

Tài liệu cùng người dùng

Tài liệu liên quan