Example: confidence

Practical Perl Programming

Practical perl Programming A. D. Marshall 1999 HTML perl NOTESC ontentsl Introduction to PerlWhat is perl ?Originsn Similar to C?n Cost and Licensingn m Installing perl InstalledGetting and Installing Perln m Writing perl ProgramsCreating the Programn Invocationn Comments in Your Programn m Further Reading/Informationm l Numeric and String LiteralsNumeric LiteralsExample: Numbersn m String LiteralsExample: Single-Quoted Stringsn Example: Double-Quoted StringsExample: Back-Quoted Stringsn n m l VariablesScalar VariablesDefining Scalar Variablesn String Scalar Variablesn m l ArraysWhat is an Array?m Literal Arraysm l Indexed Arraysm Some Useful Array Functionsm Associative ArraysAssociative Array Operatorsn m OperatorsThe Binary Arithmetic Operatorsm The Unary Arithmetic Operatorsm The Logical Operatorsm The Bitwise OperatorsComparison operators for numbers and stringsn m The Range Operator (.)

Practical Perl Programming A. D. Marshall 1999 HTML PERL NOTES Contents Introduction to Perl What is Perl? Origins Similar to C? Cost and Licensing Installing Perl Installed Getting and Installing Perl Writing Perl Programs Creating the Program

Tags:

  Programming, Practical, Perl, Practical perl programming

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Advertisement

Transcription of Practical Perl Programming

1 Practical perl Programming A. D. Marshall 1999 HTML perl NOTESC ontentsl Introduction to PerlWhat is perl ?Originsn Similar to C?n Cost and Licensingn m Installing perl InstalledGetting and Installing Perln m Writing perl ProgramsCreating the Programn Invocationn Comments in Your Programn m Further Reading/Informationm l Numeric and String LiteralsNumeric LiteralsExample: Numbersn m String LiteralsExample: Single-Quoted Stringsn Example: Double-Quoted StringsExample: Back-Quoted Stringsn n m l VariablesScalar VariablesDefining Scalar Variablesn String Scalar Variablesn m l ArraysWhat is an Array?m Literal Arraysm l Indexed Arraysm Some Useful Array Functionsm Associative ArraysAssociative Array Operatorsn m OperatorsThe Binary Arithmetic Operatorsm The Unary Arithmetic Operatorsm The Logical Operatorsm The Bitwise OperatorsComparison operators for numbers and stringsn m The Range Operator (.)

2 M The String Operators (. and x)m Order of Precedencem l perl StatementsUnderstanding Expressionsm Statement Blocksm Statement Blocks and Local Variablesm If/Unless statementThe for statementn The while/until statementn The foreach statementn m l FunctionsUsing the Parameter Array (@_)m Passing Parameters by Referencem Scope of Variablesm Using a List as a Function Parameterm Nesting Function Callsm Using a Private Functionm String Functionsm Array Functionsm Summarym l ReferencesReference Typesm Passing Parameters to Functionsm The ref() Functionm l Example: Creating a Data Recordm Interpolating Functions Inside Double-Quoted Stringsm Summarym Files -- Input and Output in PerlSome Files Are StandardUsing the Diamond Operator (<>)n m File Test Operatorsm File FunctionsReading Directoriesn Reading and Writing Filesn Binary Filesn Getting File Statisticsn Printing Revisitedn m l Regular ExpressionsWhat are regular Expressionsm Using Regular ExpressionsSpecial pattern matching character operatorsn m Backtrackingm Setting the Target Operator (Binding)m Substitutionm The Matching Operator (m//)The Matching Optionsn m The Translation Operator (tr///)The Translation Optionsn m The Binding Operatorsm Character Classesm Quantifiersm Pattern Memorym Pattern Precedencem Extension Syntaxm Pattern Examplesm Some Practical ExamplesUsing the Match Operatorn Using the Substitution Operatorn Example: Using the Translation Operatorn m l Example.

3 Using the Split() Functionn ReportsFormat Statementsm Field Linesm Report Headingsm l Special VariablesWhat Are the Special Variables?m Example: Using the DATA File Handlem Example: Using the %ENV Variablem l Handling Errors and SignalsChecking for Errorsm Using errnom Using the || Logical Operatorm Using the die() Functionm Using the warn() Functionm Trapping Fatal ErrorsUsing the eval() Functionn m SignalsHow to Handle a Signaln m l Objects in PerlWhat are objects?m Classesm Abtractionm Polymorphism:Overriding Methodsm Encapsulation:Keeping Code and Data Togetherm Objects in PerlBless the Hash and Pass the Referencen Initializing Propertiesn Using Named Parameters in Constructorsn Inheritance: perl Stylen Polymorphismn One Class Can Contain Anothern m Static Versus Regular Methods and Variablesm l perl ModulesModule Constructors and Destructorsm l The BEGIN Blockn The END Blockn Symbol Tablesm The require Compiler Directivem The use Compiler Directivem Pragma in Perlm The strict Pragmam The Standard Modulesm strict, my() and Modulesm Module ExamplesThe Carp Modulen The English Modulen The Env Modulen m Debugging PerlSyntax Errorsm Common Syntax Errorsm Logic ErrorsUsing the -w Command-Line Optionn Being Strict with Your Variablesn Stepping Through Your ScriptDisplaying Informationn Examples.

4 Using the n Commandn Using Breakpointsn n Creating Command Aliasesn Using the Debugger as an Interactive Interpretern m Summarym l perl Command-Line OptionsHow Are the Options Specified?m The Command-line Optionsm Example uses of command-line optionsUsing the -0 Optionn Using the -n and -p Optionsn Using the -i Optionn Using the -s Optionn m Summarym l Networking with PerlSocketsm Clients and ServersThe Server Side of a Conversationn The Client Side of a Conversationn m Some Network ExamplesUsing the Time Servicen Sending Mail (SMTP)The MAIL Commandn The RCPT Commandn The DATA Commandn Reporting Undeliverable Mailn Using perl to Send Mailn n m Receiving Mail (POP)Checking for Upness (Echo)n m Transferring Files (FTP)The World Wide Web (HTTP)n m l CGI Programming in PerlCGI ScriptingWhat is a CGI Script?n Writing and Running CGI Scriptsn Why Use perl for CGI?n CGI Apps versus Java Appletsn Should You Use CGI Modules?

5 N m How Does CGI Work?m Calling Your CGI Programm Beginning CGI Programming in PerlCGI Script Outputn A First perl CGI Scriptn Exectiion of CGI Programsn Why Are File Permissions Important in UNIX?n m HTTP HeadersCGI and Environment Variablesn m URL Encodingm Securitym l CGIwrap and Securityn The Other Side of CGI:Input -- HTML FormsA Brief Overview of HTMLm Server-Side Includesm Forms: Facilitating User Input and InteractionForms and CGI: What are they?n Some Example Formsn The FORM Tagn Entering DataThe Submit Buttonn Text Inputn n Passwordn Associating labels with text and password inputn Radio Buttonsn Checkboxesn Assigning Initial Input Values ton Selectn Textarean Hidden Inputn An Example Formn HTML Forms as an Interface to Databasesn Further Informationn m CGI Script Input: Accepting Input To perl ScriptsAccepting Input from the Browsern Passing Data to a CGI Scriptn A Simple Form CGI Script Calln The Other Side -- receiving and processing information in CGI ( perl )

6 Scriptn The modulen A Minimal Form Response CGI perl Scriptn Multiple argument input to a perl CGI scriptn m l Some Example perl CGI ScriptsRed, Green and Blue to Hexadecimal Converterm An Address Book Search Enginem Creating a Guest Bookm l A Web Page Counterm Using perl with Web ServersServer Log Filesm Reading a Log File In Perlm Listing Access by Documentm Looking at the Status Codem Existing Log File Analyzing Programsm Creating Your Own CGI Log Filem l Internet ResourcesWeb Sitesm Usenet Newsgroupsm l A Quick Quide to HTMLB asic HTML ProgrammingHTMLn Hypertext Terminologyn Creating HTML Documentsn Learning HTMLn Anatomy of Any HTML Documentn HTML TagsBasic HTML Page Structuren n Summary of Basic HTML Tagsn Bare-bones example of HTMLn Basic HTML CodingHead elementsn n The Body Elementn Headingsn Paragraphsn Commentsn Links and AnchorsLinking to Other Documentsn n Relative.

7 Absolute and remote LinksAnchorsn n ListsUnordered or Bulleted listsn Ordered or Numbered listsn n m l Glossary or Definition Listsn Nesting Listsn Preformatted Textn In-Line Imagesn External Images, Sounds, Videon Things to remember when HTML programmingn Text Formatting with HTMLL ogical Character Formattingn Physical Character formattingn Special Charactersn Horizontal rules and Line breaksn Fonts and Font Sizesn m Recommended Readingm About this document ..l next up previousNext: Introduction to perl Up: Practical perl Programming Previous: Practical perl ProgrammingContentsContentsl Introduction to PerlWhat is perl ?Originsn Similar to C?n Cost and Licensingn m Installing perl InstalledGetting and Installing Perln m Writing perl ProgramsCreating the Programn Invocationn Comments in Your Programn m Further Reading/Informationm l Numeric and String LiteralsNumeric Literalsm String LiteralsExample: Double-Quoted Stringsn m l VariablesScalar VariablesDefining Scalar Variablesn String Scalar Variablesn m l ArraysWhat is an Array?

8 M Literal Arraysm Indexed Arraysm Some Useful Array Functionsm Associative ArraysAssociative Array Operatorsn m l Operatorsl The Binary Arithmetic Operatorsm The Unary Arithmetic Operatorsm The Logical Operatorsm The Bitwise OperatorsComparison operators for numbers and stringsn m The Range Operator (..)m The String Operators (. and x)m Order of Precedencem perl StatementsUnderstanding Expressionsm Statement Blocksm Statement Blocks and Local Variablesm If/Unless statementThe for statementn The while/until statementn The foreach statementn m l FunctionsUsing the Parameter Array (@_)m Passing Parameters by Referencem Scope of Variablesm Using a List as a Function Parameterm Nesting Function Callsm Using a Private Functionm String Functionsm Array Functionsm Summarym l ReferencesReference Typesm Passing Parameters to Functionsm The ref() Functionm Example: Creating a Data Recordm Interpolating Functions Inside Double-Quoted Stringsm Summarym l Files -- Input and Output in PerlSome Files Are Standardm l Using the Diamond Operator (<>)n File Test Operatorsm File FunctionsReading Directoriesn Reading and Writing Filesn Binary Filesn Getting File Statisticsn Printing Revisitedn m Regular ExpressionsWhat are regular Expressionsm Using Regular ExpressionsSpecial pattern matching character operatorsn m Backtrackingm Setting the Target Operator (Binding)m Substitutionm The Matching Operator (m//)The Matching Optionsn m The Translation Operator (tr///)The Translation Optionsn m The Binding Operatorsm Character Classesm Quantifiersm Pattern Memorym Pattern Precedencem Extension Syntaxm Pattern Examplesm Some Practical ExamplesUsing the Match Operatorn Using the Substitution Operatorn Example: Using the Translation Operatorn Example.

9 Using the Split() Functionn m l ReportsFormat Statementsm Field Linesm Report Headingsm l Special VariablesWhat Are the Special Variables?m Example: Using the DATA File Handlem Example: Using the %ENV Variablem l Handling Errors and SignalsChecking for Errorsm Using errnom Using the || Logical Operatorm Using the die() Functionm Using the warn() Functionm Trapping Fatal ErrorsUsing the eval() Functionn m SignalsHow to Handle a Signaln m l Objects in PerlWhat are objects?m Classesm Abtractionm Polymorphism:Overriding Methodsm Encapsulation:Keeping Code and Data Togetherm Objects in PerlBless the Hash and Pass the Referencen Initializing Propertiesn Using Named Parameters in Constructorsn Inheritance: perl Stylen Polymorphismn One Class Can Contain Anothern m Static Versus Regular Methods and Variablesm l perl ModulesModule Constructors and DestructorsThe BEGIN Blockn The END Blockn m Symbol Tablesm The require Compiler Directivem The use Compiler Directivem l Pragma in Perlm The strict Pragmam The Standard Modulesm strict, my() and Modulesm Module ExamplesThe Carp Modulen The English Modulen The Env Modulen m Debugging PerlSyntax Errorsm Common Syntax Errorsm Logic ErrorsUsing the -w Command-Line Optionn Being Strict with Your Variablesn Stepping Through Your ScriptDisplaying Informationn Using Breakpointsn n Creating Command Aliasesn Using the Debugger as an Interactive Interpretern m Summarym l perl Command-Line OptionsHow Are the Options Specified?

10 M The Command-line Optionsm Example uses of command-line optionsUsing the -0 Optionn Using the -n and -p Optionsn Using the -i Optionn Using the -s Optionn m Summarym l Networking with PerlSocketsm Clients and ServersThe Server Side of a Conversationn The Client Side of a Conversationn m Some Network Examplesm l Using the Time Servicen Sending Mail (SMTP)The MAIL Commandn The RCPT Commandn The DATA Commandn Reporting Undeliverable Mailn Using perl to Send Mailn n Receiving Mail (POP)Checking for Upness (Echo)n m Transferring Files (FTP)The World Wide Web (HTTP)n m CGI Programming in PerlCGI ScriptingWhat is a CGI Script?n Writing and Running CGI Scriptsn Why Use perl for CGI?n CGI Apps versus Java Appletsn Should You Use CGI Modules?n m How Does CGI Work?m Calling Your CGI Programm Beginning CGI Programming in PerlCGI Script Outputn A First perl CGI Scriptn Exectiion of CGI Programsn Why Are File Permissions Important in UNIX?


Related search queries