Praise for Ellie Quigley’s Books“I picked up a copy of JavaScript by Example over the weekend and wanted to thank youfor putting out a book that makes JavaScript easy to understand. I’ve been a developer forseveral years now and JS has always been the ‘monster under the bed,’ so to speak. Yourbook has answered a lot of questions I’ve had about the inner workings of JS but was afraidto ask. Now all I need is a book that covers Ajax and Coldfusion. Thanks again for puttingtogether an outstanding book.”—Chris Gomez, Web services manager,Zunch Worldwide, Inc.“I have been reading your UNIX Shells by Example book, and I must say, it is brilliant.Most other books do not cover all the shells, and when you have to constantly work inan organization that uses tcsh, bash, and korn, it can become very difficult. However,your book has been indispensable to me in learning the various shells and the differencesbetween them so I thought I’d email you, just to let you know what a great job you havedone!”—Farogh-Ahmed Usmani, B.Sc. (Honors), M.Sc., DIC,project consultant (Billing Solutions), Comverse“I have been learning Perl for about two months now; I have a little shell scripting experiencebut that is it. I first started with Learning Perl by O’Reilly. Good book but lacking on theexamples. I then went to Programming Perl by Larry Wall, a great book for intermediateto advanced, didn’t help me much beginning Perl. I then picked up Perl by Example,Third Edition—this book is a superb, well-written programming book. I have read manycomputer books and this definitely ranks in the top two, in my opinion. The examples areexcellent. The author shows you the code, the output of each line, and then explains eachline in every example.”—Dan Patterson, software engineer,GuideWorks, LLC“Ellie Quigley has written an outstanding introduction to Perl, which I used to learn thelanguage from scratch. All one has to do is work through her examples, putz around withthem, and before long, you’re relatively proficient at using the language. Even though I’vegraduated to using Programming Perl by Wall et al., I still find Quigley’s book a most usefulreference.”—Casey Machula, support systems analyst,Northern Arizona University, College of Health and Human Services
“When I look at my bookshelf, I see eleven books on Perl programming. Perl by Example,Third Edition, isn’t on the shelf; it sits on my desk, where I use it almost daily. When Ibought my copy I had not programmed in several years and my programming was mostlyin COBOL so I was a rank beginner at Perl. I had at that time purchased several popularbooks on Perl but nothing that really put it together for me. I am still no pro, but mybook has many dog-eared pages and each one is a lesson I have learned and will certainlyremember.“I still think it is the best Perl book on the market for anyone from a beginner to aseasoned programmer using Perl almost daily.”—Bill Maples, network design tools and automations analyst,Fidelity National Information Services“We are rewriting our intro to OS scripting course and selected your text for the course.[UNIX Shells by Example is] an exceptional book. The last time we considered it was a fewyears ago (second edition). The debugging and system administrator chapters at the endnailed it for us.”—Jim Leone, Ph.D., professor and chair, Information Technology,Rochester Institute of Technology“Quigley’s [PHP and MySQL by Example] acknowledges a major usage of PHP. To write somekind of front end user interface program that hooks to a back end MySQL database. Bothare free and open source, and the combination has proved popular. Especially where thefront end involves making an HTML web page with embedded PHP commands.“Not every example involves both PHP and MySQL. Though all examples have PHP. Manydemonstrate how to use PHP inside an HTML file. Like writing user-defined functions, ornesting functions. Or making or using function libraries. The functions are a key idea inPHP, that take you beyond the elementary syntax. Functions also let you gainfully use codeby other PHP programmers. Important if you are part of a coding group that has to divideup the programming effort in some manner.”—Dr. Wes Boudville, CTO,Metaswarm Inc.
Perl by ExampleFif th Edition
This page intentionally left blank
Perl by ExampleFif th EditionEllie QuigleyUpper Saddle River, NJ Boston Indianapolis San FranciscoNew York Toronto Montreal London Munich Paris MadridCapetown Sydney Tokyo Singapore Mexico City
Many of the designations used by manufacturers and sellers to distinguish theirproducts are claimed as trademarks. Where those designations appear in this book, andthe publisher was aware of a trademark claim, the designations have been printed withinitial capital letters or in all capitals.The author and publisher have taken care in the preparation of this book, but makeno expressed or implied warranty of any kind and assume no responsibility for errorsor omissions. No liability is assumed for incidental or consequential damages inconnection with or arising out of the use of the information or programs containedherein.For information about buying this title in bulk quantities, or for special salesopportunities (which may include electronic versions; custom cover designs; andcontent particular to your business, training goals, marketing focus, or brandinginterests), please contact our corporate sales department at corpsales@pearsoned.comor (800) 382-3419.For government sales inquiries, please contact governmentsales@pearsoned.com.For questions about sales outside the U.S., please contact international@pearsoned.com.Visit us on the Web: informit.comLibrary of Congress Cataloging-in-Publication DataQuigley, Ellie.Perl by example / Ellie Quigley.—Fifth edition.pages cmIncludes index.ISBN 978-0-13-376081-1 (pbk. : alk. paper)1. Perl (Computer program language) I. Title.QA76.73.P22Q53 2015005.13'3—dc232014036613Copyright 2015 Pearson Education, Inc.All rights reserved. Printed in the United States of America. This publication isprotected by copyright, and permission must be obtained from the publisher prior toany prohibited reproduction, storage in a retrieval system, or transmission in any formor by any means, electronic, mechanical, photocopying, recording, or likewise. Toobtain permission to use material from this work, please submit a written request toPearson Education, Inc., Permissions Department, One Lake Street, Upper Saddle River,New Jersey 07458, or you may fax your request to (201) 236-3290.ISBN-13: 978-0-13-376081-1ISBN-10: 0-13-376081-2Text printed in the United States on recycled paper at Edwards Brothers Malloy in AnnArbor, Michigan.First printing, December 2014Editor-in-ChiefMark L. TaubDevelopment EditorsMichael ThurstonChris ZahnManaging EditorJohn FullerFull-ServiceProduction ManagerJulie B. NahilProject ManagerMoore Media, Inc.Copy EditorMoore Media, Inc.IndexerLarry SweazyProofreaderPam PalmerCover DesignerChuti PrasertsithCompositionMoore Media, Inc.
Practical Extraction and Report Language 1What Is Perl? 1What Is an Interpreted Language? 2Who Uses Perl? 31.3.1Which Perl? 41.3.2What Are Perl 6, Rakudo Perl, and Parrot? 4Where to Get Perl 61.4.1CPAN (cpan.org) 61.4.2Downloads and Other Resources for Perl (perl.org) 71.4.3ActivePerl (activestate.com) 81.4.4What Version Do I Have? 9Perl Documentation 91.5.1Where to Find the Most Complete Documentation from Perl 91.5.2Perl man Pages 101.5.3Online Documentation 12What You Should Know 13What’s Next? 13Perl Quick Start 152.1 Quick Start, Quick Reference 152.1.1A Note to Programmers 152.1.2A Note to Non-Programmers 152.1.3Perl Syntax and Constructs 15Regular Expressions 28Passing Arguments at the Command Line 29vii
viiiContents2.22.3References and Pointers 29Objects 30Libraries and Modules 31Diagnostics 31Chapter Summary 32What’s Next? 323Perl Scripts 333.1 Getting Started 333.1.1Finding a Text Editor 343.1.2Naming Perl Scripts 353.1.3Statements, Whitespace, and Linebreaks 353.1.4Strings and Numbers 363.2 Filehandles 373.3 Variables (Where to Put Data) 373.3.1What Is Context? 383.3.2Comments 383.3.3Perl Statements 393.3.4Using Perl Built-in Functions 393.3.5Script Execution 403.4 Summing It Up 423.4.1What Kinds of Errors to Expect 433.5 Perl Switches 443.5.1The -e Switch (Quick Test at the Command Line) 453.5.2The -c Switch (Check Syntax) 463.5.3The -w Switch (Warnings) 463.6 What You Should Know 473.7 What’s Next? 47EXERCISE 3 Getting with It Syntactically 484Getting a Handle on Printing 494.1 The Special Filehandles STDOUT, STDIN, STDERR 494.2 Words 514.3 The print Function 514.3.1Quotes Matter! 52Double Quotes 53Single Quotes 54Backquotes 54Perl’s Alternative Quotes 55
ixContents4.3.24.44.54.64.75Literals (Numeric, String, and Special) 59Numeric Literals 60String Literals 61Special Literals 634.3.3Printing Without Quotes—The here document 66here documents and CGI 67Fancy Formatting with the printf Function 694.4.1Saving Formatting with the sprintf Function 73The No Newline say Function 734.4.2What Are Pragmas? 744.5.1The feature Pragma 744.5.2The warnings Pragma 754.5.3The diagnostics Pragma 764.5.4The strict Pragma and Words 77What You Should Know 78What’s Next? 79EXERCISE 4 A String of Perls 79What’s In a Name? 815.1 More About Data Types 815.1.1Basic Data Types (Scalar, Array, Hash) 815.1.2Package, Scope, Privacy, and Strictness 82Package and Scope 825.1.3Naming Conventions 855.1.4Assignment Statements 865.2 Scalars, Arrays, and Hashes 875.2.1Scalar Variables 88Assignment 88The defined Function 89The undef Function 89The Scalar Variable 905.2.2Arrays 91Assignment 92Output and Input Special Variables ( , and ") 93Array Size 94The Range Operator and Array Assignment 95Accessing Elements 95Looping Through an Array with the foreach Loop 97Array Copy and Slices 98Multidimensional Arrays—Lists of Lists 99
xContents5.2.35.35.4Hashes—Unordered Lists 99Assignment 100Accessing Hash Values 101Hash Slices 102Removing Duplicates from a List Using a Hash 1035.2.4Complex Data Structures 104Array Functions 1055.3.1Adding Elements to an Array 105The push Function 105The unshift Function 1065.3.2Removing and Replacing Elements 106The delete Function 106The splice Function 107The pop Function 109The shift Function 1105.3.3Deleting Newlines 111The chop and chomp Functions (with Lists) 1115.3.4Searching for Elements and Index Values 112The grep Function 1125.3.5Creating a List from a Scalar 114The split Function 1145.3.6Creating a Scalar from a List 118The join Function 1185.3.7Transforming an Array 119The map Function 1195.3.8Sorting an Array 121The sort Function 1215.3.9Checking the Existence of an Array Index Value 124The exists Function 1245.3.10 Reversing an Array 125The reverse Function 125Hash (Associative Array) Functions 1255.4.1The keys Function 1255.4.2The values Function 1265.4.3The each Function 1285.4.4Removing Duplicates from a List with a Hash 1295.4.5Sorting a Hash by Keys and Values 130Sort Hash by Keys in Ascending Order 130Sort Hash by Keys in Reverse Order 131Sort Hash by Keys Numerically 132Numerically Sort a Hash by Values in Ascending Order 133
xiContents5.55.66Numerically Sort a Hash by Values in Descending Order 1345.4.6The delete Function 1355.4.7The exists Function 1365.4.8Special Hashes 137The %ENV Hash 137The %SIG Hash 138The %INC Hash 1395.4.9Context Revisited 139What You Should Know 140What’s Next? 141EXERCISE 5 The Funny Characters 141Where’s the Operator? 1456.1 About Perl Operators—More Context 1456.1.1Evaluating an Expression 1476.2 Mixing Types 1486.3 Precedence and Associativity 1496.3.1Assignment Operators 1516.3.2Boolean 1536.3.3Relational Operators 154Numeric 154String 1556.3.4Conditional Operators 1566.3.5Equality Operators 157Numeric 157String 1596.3.6The Smartmatch Operator 1606.3.7Logical Operators (Short-Circuit Operators) 1626.3.8Logical Word Operators 1646.3.9Arithmetic Operators and Functions 166Arithmetic Operators 166Arithmetic Functions 1676.3.10 Autoincrement and Autodecrement Operators 1726.3.11 Bitwise Logical Operators 173A Little Bit About Bits 173Bitwise Operators 1746.3.12 Range Operator 1756.3.13 Special String Operators and Functions 1766.4 What You Should Know 1786.5 What’s Next? 179EXERCISE 6 Operator, Operator 179
xiiContents7If Only, Unconditionally, Forever 1817.1 Control Structures, Blocks, and Compound Statements 1827.1.1Decision Making—Conditional Constructs 183if and unless Statements 183The if Construct 183The if/else Construct 184The if/elsif/else Construct 185The unless Construct 1867.2 Statement Modifiers and Simple Statements 1887.2.1The if Modifier 1887.2.2The unless Modifier 1897.3 Repetition with Loops 1907.3.1The while Loop 1907.3.2The until Loop 1927.3.3The do/while and do/until Loops 1947.3.4The for Loop (The Three-Part Loop) 1967.3.5The foreach (for) Loop 1987.4 Looping Modifiers 2027.4.1The while Modifier 2027.4.2The foreach Modifier 2037.4.3Loop Control 204Labels 204The redo and goto Statements 205Nested Loops and Labels 208The continue Statement 2107.4.4The switch Statement (given/when) 212The switch Feature (given/when/say) 2147.5 What You Should Know 2177.6 What’s Next? 217EXERCISE 7 What Are Your Conditions? 2188Regular Expressions—Pattern Matching 2198.1 What Is a Regular Expression? 2198.1.1Why Do We Need Regular Expressions? 2208.2 Modifiers and Simple Statements with Regular Expressions 2218.2.1Pattern Binding Operators 2228.2.2The DATA Filehandle 2238.3 Regular Expression Operators 2258.3.1The m Operator and Pattern Matching 225The g Modifier—Global Match 229The i Modifier—Case Insensitivity 230
xiiiContents8.48.59Special Scalars for Saving Patterns 230The x Modifier—The Expressive Modifier 2318.3.2The s Operator and Substitution 2328.3.3The Pattern Binding Operators with Substitution 232Changing the Substitution Delimiters 234Substitution Modifiers 235Using the Special & Variable in a Substitution 240Pattern Matching with a Real File 241What You Should Know 243What’s Next? 243EXERCISE 8 A Match Made in Heaven 244Getting Control—Regular Expression Metacharacters 2459.1 The RegExLib.com Library 2459.2 Regular Expression Metacharacters 2479.2.1Metacharacters for Single Characters 251The Dot Metacharacter 251The s Modifier—The Dot Metacharacter and the Newline 252The Character Class 253The POSIX Bracket Expressions 2579.2.2Whitespace Metacharacters 2589.2.3Metacharacters to Repeat Pattern Matches 261The Greed Factor 261Metacharacters That Turn off Greediness 267Anchoring Metacharacters 269The m Modifier 271Alternation 273Grouping or Clustering 273Remembering or Capturing 276Turning off Greed 280Turning off Capturing 281Metacharacters That Look Ahead and Behind 2829.2.4The tr or y Operators 285The d Delete Option 288The c Complement Option 289The s Squeeze Option 2909.3 Unicode 2909.3.1Perl and Unicode 2919.4 What You Should Know 2949.5 What’s Next? 295EXERCISE 9 And the Search Goes On . . . 295
xiv10ContentsGetting a Handle on Files 29710.1 The User-Defined Filehandle 29710.1.1 Opening Files—The open Function 29710.1.2 Opening for Reading 298Closing the Filehandle 299The die Function 29910.1.3 Reading from a File and Scalar Assignment 300The Filehandle and 300The Filehandle and a User-Defined Scalar Variable 301“Slurping” a File into an Array 302Using map to Create Fields from a File 303Slurping a File into a String with the read Function 30410.1.4 Loading a Hash from a File 30610.2 Reading from STDIN 30710.2.1 Assigning Input to a Scalar Variable 30710.2.2 The chop and chomp Functions 30810.2.3 The read Function 30910.2.4 The getc Function 31010.2.5 Assigning Input to an Array 31110.2.6 Assigning Input to a Hash 31210.2.7 Opening for Writing 31310.2.8 Win32 Binary Files 31510.2.9 Opening for Appending 31610.2.10 The select Function 31710.2.11 File Locking with flock 31710.2.12 The seek and tell Functions 319The seek Function 319The tell Function 32210.2.13 Opening for Reading and Writing 32410.2.14 Opening for Anonymous Pipes 326The Output Filter 327Sending the Output of a Filter to a File 329Input Filter 33010.3 Passing Arguments 33310.3.1 The @ARGV Array 33310.3.2 ARGV and the Null Filehandle 33410.3.3 The eof Function 33810.3.4 The -i Switch—Editing Files in Place 34010.4 File Testing 34210.5 What You Should Know 34410.6 What’s Next? 344EXERCISE 10 Getting a Handle on Things 345
Contents11How Do Subroutines Function? 34711.1 Subroutines/Functions 34811.1.1 Defining and Calling a Subroutine 349Forward Declaration 351Scope of Variables 35111.2 Passing Arguments and the @ Array 35211.2.1 Call-by-Reference and the @ Array 35311.2.2 Assigning Values from @ 353Passing a Hash to a Subroutine 35511.2.3 Returning a Value 35611.2.4 Scoping Operators: local, my, our, and state 357The local Operator 358The my Operator 35811.2.5 Using the strict Pragma (my and our) 361The state Feature 36311.2.6 Putting It All Together 36411.2.7 Prototypes 36511.2.8 Context and Subroutines 366The wantarray Function and User-Defined Subroutines 36711.2.9 Autoloading 36911.2.10 BEGIN and END Blocks (Startup and Finish) 37111.2.11 The subs Function 37111.3 What You Should Know 37311.4 What’s Next? 373EXERCISE 11 I Can’t Seem to Function Without Subroutines 37412Does This Job Require a Reference? 37712.1 What Is a Reference? 37712.1.1 Hard References 378The Backslash Operator 379Dereferencing the Pointer 37912.1.2 References and Anonymous Variables 382Anonymous Arrays 382Anonymous Hashes 38312.1.3 Nested Data Structures 383Using Data::Dumper 384Array of Lists 385Array of Hashes 387Hash of Hashes 38912.1.4 More Nested Structures 391xv
xviContents12.1.5References and Subroutines 393Anonymous Subroutines 393Subroutines and Passing by Reference 39412.1.6 The ref Function 39612.1.7 Symbolic References 398The strict Pragma 40012.1.8 Typeglobs (Aliases) 400Filehandle References and Typeglobs 40212.2 What You Should Know 40412.3 What’s Next? 404EXERCISE 12 It’s Not Polite to Point! 40513Modularize It, Package It, and Send It to the Library! 40713.1 Before Getting Started 40713.1.1 An Analogy 40813.1.2 What Is a Package? 408Referencing Package Variables and Subroutines from Another Package 40913.1.3 What Is a Module? 41113.1.4 The Symbol Table 41213.2 The Standard Perl Library 41713.2.1 The @INC Array 418Setting the PERL5LIB Environment Variable 419The lib Pragma 42013.2.2 Packages and .pm Files 420The require Function 421The use Function (Modules and Pragmas) 421Using Perl to Include Your Own Library 42213.2.3 Exporting and Importing 424The Exporter.pm Module 42413.2.4 Finding Modules and Documentation from the Standard Perl Library 427Viewing the Contents of the Carp.pm Module 42813.2.5 How to “Use” a Module from the Standard Perl Library 43113.2.6 Using Perl to Create Your Own Module 432Creating an Import Method Without Exporter 43513.3 Modules from CPAN 43613.3.1 The CPAN.pm Module 437Retrieving a Module from CPAN with the cpan Shell 43813.3.2 Using Perl Program Manager 43913.4 Using Perlbrew and CPAN Minus 44113.5 What You Should Know 444
Contents13.6 What’s Next? 445EXERCISE 13 I Hid All My Perls in a Package 44514Bless Those Things! (Object-Oriented Perl) 44714.1 The OOP Paradigm 44714.1.1 What Are Objects? 44714.1.2 What Is a Class? 44814.1.3 Some Object-Oriented Lingo 44914.2 Perl Classes, Objects, and Methods—Relating to the Real World 45014.2.1 The Steps 45114.2.2 A Complete Object-Oriented Perl Program 451A Perl Package Is a Class 453A Perl Class 45314.2.3 Perl Objects 454References 454The Blessing 45414.2.4 Methods Are Perl Subroutines 456Definition 456Types of Methods 457Invoking Methods 457Creating the Object with a Constructor 458Creating the Instance Methods 460Invoking the Methods (User Interaction) 46214.2.5 Creating an Object-Oriented Module 464Passing Arguments to Methods 466Passing Parameters to Instance Methods 467Named Parameters and Data Checking 47014.2.6 Polymorphism and Runtime Binding 47214.2.7 Destructors and Garbage Collection 47614.3 Anonymous Subroutines, Closures, and Privacy 47814.3.1 What Is a Closure? 47814.3.2 Closures and Objects 48114.4 Inheritance 48414.4.1 The @ISA Array and Calling Methods 48414.4.2 AUTOLOAD, sub AUTOLOAD, and UNIVERSAL 48614.4.3 Derived Classes 48914.4.4 Multiple Inheritance and Roles with Moose 49614.4.5 Overriding a Parent Method and the SUPER Pseudo Class 49914.5 Plain Old Documentation—Documenting a Module 50114.5.1 pod Files 50214.5.2 pod Commands 504Checking Your pod Commands 504xvii
xviiiContents14.5.3 How to Use the pod Interpreters 50614.5.4 Translating pod Documentation into Text 50614.5.5 Translating pod Documentation into HTML 50714.6 Using Objects from the Perl Library 50814.6.1 An Object-Oriented Module from the Standard Perl Library 50914.6.2 Using a Module with Objects from the Standard Perl Library 51114.7 What You Should Know 51214.8 What’s Next? 513EXERCISE 14 What’s the Object of This Lesson? 51315Perl Connects with MySQL 51915.1 Introduction 51915.2 What Is a Relational Database? 52015.2.1 Client/Server Databases 52115.2.2 Components of a Relational Database 522The Database Server 523The Database 523Tables 523Records and Fields 524The Database Schema 52715.2.3 Talking to the Database with SQL 528English-like Grammar 528Semicolons Terminate SQL Statements 529Naming Conventions 529Reserved Words 529Case Sensitivity 529The Result Set 53015.3 Getting Started with MySQL 53015.3.1 Installing MySQL 53115.3.2 Connecting to MySQL 532Editing Keys at the MySQL Console 533Setting a Password 53315.3.3 Graphical User Tools 534The MySQL Query Browser 534The MySQL Privilege System 53615.3.4 Finding the Databases 537Creating and Dropping a Database 53815.3.5 Getting Started with Basic Commands 539Creating a Database with MySQL 539Selecting a Database with MySQL 541Creating a Table in the Database 541Data Types 541
ContentsAdding Another Table with a Primary Key 543Inserting Data into Tables 544Selecting Data from Tables—The SELECT Command 546Selecting by Columns 546Selecting All Columns 547The WHERE Clause 548Sorting Tables 550Joining Tables 551Deleting Rows 552Updating Data in a Table 553Altering a Table 554Dropping a Table 555Dropping a Database 55515.4 What Is the Perl DBI? 55615.4.1 Installing the DBD Driver 556Without the DBD-MySQL with PPM 556Using PPM with Linux 558Installing the DBD::mysql Driver from CPAN 55815.4.2 The DBI Class Methods 55815.4.3 How to Use DBI 56015.4.4 Connecting to and Disconnecting from the Database 561The connect() Method 561The disconnect() Method 56315.4.5 Preparing a Statement Handle and Fetching Results 563Select, Execute, and Dump the Results 563Select, Execute, and Fetch a Row As an Array 564Select, Execute, and Fetch a Row As a Hash 56615.4.6 Getting Error Messages 567Automatic Error Handling 567Manual Error Handling 567Binding Columns and Fetching Values 56915.4.7 The ? Placeholder and Parameter Binding 571Binding Parameters in the execute Statement 571Binding Parameters and the bind param() Method 57415.4.8 Handling Quotes 57615.4.9 Cached Queries 57715.5 Statements That Don’t Return Anything 57915.5.1 The do( ) Method 579Adding Entries 579Deleting Entries 580Updating Entries 58115.6 Transactions 58315.6.1 Commit and Rollback 583xix
xxContents15.6.2 Perl DBI, the Web, and the Dancer Framework 58515.7 What’s Left? 59015.8 What You Should Know 59115.9 What’s Next? 591EXERCISE 15 Practicing Queries and Using DBI 59216Interfacing with the System 59516.1 System Calls 59516.1.1 Directories and Files 597Backslash Issues 597The File::Spec Module 59816.1.2 Directory and File Attributes 599UNIX 599Windows 60016.1.3 Finding Directories and Files 60316.1.4 Creating a Directory—The mkdir .5 Removing a Directory—The rmdir Function 60716.1.6 Changing Directories—The chdir Function 60716.1.7 Accessing a Directory via the Directory Filehandle 608The opendir Function 609The readdir Function 609The closedir Function 610The telldir Function 611The rewinddir Function 611The seekdir Function 61116.1.8 Permissions and Ownership 612UNIX 612Windows 612The chmod Function (UNIX) 614The chmod Function (Windows) 614The chown Function (UNIX) 615The umask Function (UNIX) 61616.1.9 Hard and Soft Links 616UNIX 616Windows 617The link and unlink Functions (UNIX) 618The symlink and readlink Functions (UNIX) 61916.1.10 Renaming Files 620The rename Function (UNIX and Windows) 62016.1.11 Changing Access and Modification Times 620
ContentsThe utime Function 62016.1.12 File Statistics 621The stat and lstat Functions 62116.1.13 Packing and Unpacking Data 62416.2 Processes 62916.2.1 UNIX Processes 62916.2.2 Win32 Processes 63116.2.3 The Environment (UNIX and Windows) 63216.2.4 Processes and Filehandles 634Login Information—The getlogin Function 635Special Process Variables (pid, uid, euid, gid, egid) 635The Parent Process ID—The getppid Function and the Variable 635The Process Group ID—The pgrp Function 63616.2.5 Process Priorities and Niceness 637The getpriority Function 637The setpriority Function (nice) 63716.2.6 Password Information 638UNIX 638Windows 639Getting a Password Entry (UNIX)—The getpwent Function 641Getting a Password Entry by Username—The getpwnam Function 642Getting a Password Entry by uid—The getpwuid Function 64316.2.7 Time and Processes 643The Time::Piece Module 644The times Function 645The time Function (UNIX and Windows) 646The gmtime Function 646The localtime Function 64816.2.8 Process Creation UNIX 649The fork Function 649The exec Funtion 652The wait and waitpid Functions 653The exit Function 65416.2.9 Process Creation Win32 654The start Command 654The Win32::Spawn Function 655The Win32::Process Module 65616.3 Other Ways to Interface with the Operating System 65816.3.1 The syscall Function and the h2ph Script 65816.3.2 Command Substitution—The Backquotes 65916.3.3 The Shell.pm Module 66016.3.4 The system Function 66116.3.5 Globbing (Filename Expansion and Wildcards) 663xxi
xxiiContents16.4 Error Handling 66416.4.1 The Carp Module 665The die Function 665The warn Function 66616.4.2 The eval Function 66616.5 Signals and the %SIG Hash 66916.5.1 Catching Signals 66916.5.2 Sending Signals to Processes 670The kill Function 670The alarm Function 671The sleep Function 67216.5.3 Attention, Windows Users! 67216.6 What You Should Know 673EXERCISE 16 Interfacing with the System 674APerlA.1A.2A.3A.4A.5A.6Built-ins, Pragmas, Modules, and the Debugger 675Perl Functions 675Special Variables 705Perl Pragmas 708Perl Modules 710Command-Line Switches 716Debugger 718A.6.1 Getting Information About the Debugger 718A.6.2 The Perl Debugger 718A.6.3 Entering and Exiting the Debugger 719A.6.4 Debugger Commands 720BSQL Language Tutorial 723B.1 What Is SQL? 723B.1.1Standarizing SQL 724B.1.2Executing SQL Statements 724The MySQL Query Browser 725B.1.3About SQL Commands/Queries 725English-like Grammar 725Semicolons Terminate SQL Statements 726Naming Conventions 727Reserved Words 727Case Senstivity 727The Result Set 728B.1.4SQL and the Database 728The show databases Command 728
xxiiiContentsB.2B.3B.4The USE Command 729B.1.5SQL Database Tables 729The SHOW and DESCRIBE Commands 730SQL Data Manipulation Language (DML) 731B.2.1The SELECT Command 731Select Specified Columns 732Select All Columns 732The SELECT DISTINCT Statement 733Limiting the Number of Lines in the Result Set with LIMIT 734The WHERE Clause 736Using Quotes 737Using the and Operators 737What Is NULL? 737The and Operators 739The AND and OR Operators 740The LIKE and NOT LIKE Conditions 741Pattern Matching and the % Wildcard 741The Wildcard 743The BETWEEN Statement 743Sorting Results with ORDER BY 744B.2.2The INSERT Command 745B.2.3The UPDATE Command 746B.2.4The DELETE Statement 747SQL Data Definition Language 748B.3.1Creating the Database 748B.3.2SQL Data Types 749B.3.3Creating a Table 751B.3.4Creating a Key 753Primary Keys 753Foreign Keys 755B.3.5Relations 756Two Tables with a Common Key 756Using a Fully Qualified Name and a Dot to Join the Tables 757Aliases 758B.3.6Altering a Table 759B.3.7Dropping a Table 761B.3.8Dropping a Database 761SQL Functions 761B.4.1Numeric Functions 762Using GROUP BY 763B.4.2String Functions 765B.4.3Date and Time Functions 766Formatting the Date and Time 767The MySQL EXTRACT Command 769
xxivContentsB.5B.6Appendix Summary 770What You Should Know 770EXERCISE B Do You Speak My Language? 771CIntroduction to Moose (A Postmodern Object System for Perl 5) 775C.1 Getting Started 775C.2 The Constructor 776C.3 The Attributes 776C.3.1 The has Function 777C.3.2
1.4 Where to Get Perl 6 1.4.1 CPAN (cpan.org) 6 1.4.2 Downloads and Other Resources for Perl (perl.org) 7 1.4.3 ActivePerl (activestate.com) 8 1.4.4 What Version Do I Have? 9 1.5 Perl Documentation 9 1.5.1 Where to Find the Most Complete Documentation from Perl 9 1.5.2 Perl man Pages 10 1.5.3 Online Documentation 12
Song of Praise Knut Nystedt Praise the Lord! Praise the Lord from the heavens. Praise the Lord! Praise the Lord in the heights. Praise him all his angels, praise him all his hosts. Praise him sun and moon, praise him all you shining stars! Praise him you highest heavens, and the waters above the heavens.
Price List 2020 Nissan Quigley Motor Company, Inc. Effective 08.1.2019 Item/Details MSRP Quigley 4x4: New Untitled (5yr./100,000mi warranty) Quigley 4x4: Used 2017-2019 (See Terms and Conditions for warranty details) Quigley 4x4: Used 2016 and older (See Terms and Conditions for warranty details) Optional Upgrades (Manufacturer specific items carry the original manufacturer's warranty ONLY)
Price List 2022 Nissan Quigley Motor Company, Inc. Effective 03.01.2022 Item/Details MSRP Quigley 4x4: New Untitled (5yr./100,000mi warranty) Quigley 4x4: Used 2017-2022 (See Terms and Conditions for warranty details) Quigley 4x4: Used 2016 and older (See Terms and Conditions for warranty details) Optional Upgrades (Manufacturer speciic items carry the original manufacturer's warranty ONLY)
Bruksanvisning för bilstereo . Bruksanvisning for bilstereo . Instrukcja obsługi samochodowego odtwarzacza stereo . Operating Instructions for Car Stereo . 610-104 . SV . Bruksanvisning i original
10 tips och tricks för att lyckas med ert sap-projekt 20 SAPSANYTT 2/2015 De flesta projektledare känner säkert till Cobb’s paradox. Martin Cobb verkade som CIO för sekretariatet för Treasury Board of Canada 1995 då han ställde frågan
service i Norge och Finland drivs inom ramen för ett enskilt företag (NRK. 1 och Yleisradio), fin ns det i Sverige tre: Ett för tv (Sveriges Television , SVT ), ett för radio (Sveriges Radio , SR ) och ett för utbildnings program (Sveriges Utbildningsradio, UR, vilket till följd av sin begränsade storlek inte återfinns bland de 25 största
Hotell För hotell anges de tre klasserna A/B, C och D. Det betyder att den "normala" standarden C är acceptabel men att motiven för en högre standard är starka. Ljudklass C motsvarar de tidigare normkraven för hotell, ljudklass A/B motsvarar kraven för moderna hotell med hög standard och ljudklass D kan användas vid
LÄS NOGGRANT FÖLJANDE VILLKOR FÖR APPLE DEVELOPER PROGRAM LICENCE . Apple Developer Program License Agreement Syfte Du vill använda Apple-mjukvara (enligt definitionen nedan) för att utveckla en eller flera Applikationer (enligt definitionen nedan) för Apple-märkta produkter. . Applikationer som utvecklas för iOS-produkter, Apple .