Programming Perl

Larry Wall, Randal L. Schwartz

Publisher: O'Reilly, 1990, 454 pages

ISBN: 0-937175-664-1

Keywords: Perl

Last modified: March 21, 2022, 3:52 p.m.

This is the authoritative guide to the hottest new UNIX utility in years, co-authored by the creator of that utility.

Perl is a language for easily manipulating text, files, and processes. Perl provides more concise and readable way to do many jobs that were formerly accomplished (with difficulty) by programming in the C language or one of the shells. Even through Perl is not yet a standard part of UNIX, it is likely to be available at any UNIX site. And if it isn't, users can get it and install it easily and free of charge.

Contents include:

  • An introduction to Perl
  • Common tasks with Perl
  • Real Perl programs; include database manipulation, grep programs, programming aids, system administration, filename manipulation, text manipulation tools, processes, interprocess communication
  • Perl syntax
  • Perl functions
  • Other oddments; invocation options, debugging, efficiency, the Perl library, linking in C subroutines, etc.
  1. An Overview of Perl
    • Getting Started
      • Filehandles
      • Variables
      • How to Do It
      • A Very Special Variable
      • Conditional Constructs
      • What Is Truth?
      • Scalar Operators
      • A Brief Diversion
    • Lists
      • What's a List?
      • Wake Up!!
      • How to Do Things With Lists
    • Variable Interpolation
    • Pattern Matching
  2. Practical Programming
    • Lines and Paragraphs
      • Command Line Switches
      • Substitution
      • Words vs. Lines vs. Paragraphs
    • Tabular Data
      • Formatting a Report
      • Loading a Table into an Associative Array
      • Inverting on a Secondary Key
    • Fixed-Length Records and Fields
    • Abstraction
      • Subroutines
      • Local Variables
      • Using Subroutines as Functions
      • Recursion
  3. The Gory Details
    • Data types and objects
      • Expression context
      • Variables
      • Names
      • Literals and Interpreted Literals
      • Array Values
      • Input Operators
    • Operators
      • Operator Precedence
      • Autoincrement and Autodecrement Operators
      • Exponentiation Operator
      • Negating Operators
      • Pattern Binding Operators
      • Multiplicative Operators
      • Additive Operators
      • Shift Operators
      • File Test Operators
      • Named Unary Operators
      • Relational Operators
      • Bitwise Logical Operators
      • Short-Circuit Logical Operators
      • Range Operator
      • Conditional Operator
      • Assignment Operators
      • Comma Operator
    • Statements
      • Simple Statements
      • Compound Statements
    • Subroutines
      • Passing Arguments by Value
      • Passing Names
    • Regular Expressions
    • Formats
    • Special Variables
      • Per-Filehandle Special Variables
      • Local Special Variables
      • Global Special Variables
    • Packages
  4. Functions
    • /PATTERN/
    • ?PATTERN?
    • accept
    • alarm
    • atan2
    • bind
    • binmode
    • caller
    • chdir
    • chmod
    • chop
    • chown
    • chroot
    • close
    • closedir
    • connect
    • cos
    • crypt
    • dbmclose
    • dbmopen
    • defined
    • delete
    • die
    • do
    • dump
    • each
    • eof
    • eval
    • exec
    • exit
    • exp
    • fcntl
    • fileno
    • flock
    • fork
    • getc
    • getgent
    • getgrgid
    • getgrnam
    • gethostbyaddr
    • gethostbyname
    • gethostent
    • getlogin
    • getnetbyaddr
    • getnetbyname
    • getnetent
    • getpeername
    • getpgrp
    • getppid
    • getpriority
    • getprotobyname
    • getprotobynumber
    • getprotoent
    • getpwent
    • getpwnam
    • getpwuid
    • getservbyname
    • getservbyport
    • getservent
    • getsockname
    • gmtime
    • goto
    • grep
    • hex
    • index
    • int
    • ioctl
    • join
    • keys
    • kill
    • length
    • link
    • listen
    • local
    • localtime
    • log
    • lstat
    • mkdir
    • ¨msgctl
    • msgget
    • msgrcv
    • msgsnd
    • oct
    • open
    • opendir
    • ord
    • pack
    • pipe
    • pop
    • print
    • printf
    • push
    • rand
    • read
    • readdir
    • readlink
    • recv
    • rename
    • require
    • reset
    • return
    • reverse
    • rewinddir
    • rindex
    • rmdir
    • s
    • scalar
    • seek
    • seekdir
    • select
    • semctl
    • semget
    • semop
    • send
    • setpgrp
    • setpriority
    • setsockopt
    • shift
    • shmctl
    • shmget
    • shmread
    • shmwrite
    • shutdown
    • sin
    • sleep
    • socket
    • socketpair
    • sort
    • splice
    • split
    • sprintf
    • sqrt
    • srand
    • stat
    • study
    • substr
    • symlink
    • syscall
    • sysread
    • system
    • syswrite
    • tell
    • telldir
    • time
    • times
    • tr
    • truncate
    • umask
    • undef
    • unlink
    • unpack
    • unshift
    • utime
    • values
    • vec
    • wait
    • waitpid
    • wantarray
    • warn
    • write
  5. Common Tasks With Perl
    • Closing a Process Filehandle Without Waiting for Process Completion
    • Computing the Difference of Two Arrays
    • Computing the Intersection of Two Arrays
    • Creating Variables with (Mostly) Consecutive Constant Values
    • De-hyphenating a File
    • Executing a Block of Statements for Each Username
    • Extracting Selected Columns
    • Finding the First Array Element for Which a Condition is True
    • Finding the First Set Bit in a Vector
    • Forking a Daemon Process
    • Interpreting Variable References in a String
    • Making a Pascal-like case statement
    • Making your program run with sh and csh
    • Modifying All Elements of an Array
    • Performing an Operation on a Series of Integers
    • Prepending a Label to Successive Lines
    • Printing Lines After a Designated Matching Line
    • Printing Lines in Reverse Order
    • Printing Only the First Occurrence of Each Line
    • Printing a File with Multiple Blank Lines Squeezed Into One
    • Printing an Entire Array
    • Printing the Contents Of a File To Stdout
    • Processing Each Element of an Array
    • Processing Strings with Escaped Characters
    • Processing an Entire Associative Array
    • Putting Commas Into Integers
    • Removing Pairs of Characters
    • Renaming a File
    • Replacing a Target String with the Name of the File for Many Files
    • Returning an Error from a Subroutine when a Null List May Be Valid
    • Reversing a Line by Characters
    • Reversing a Line by Words
    • Selecting a Random Element From an Array Without Replacement
    • Selecting a Random Line From a File
    • Shuffling an Array Randomly
    • Sorting an Array by a Computable Field
    • Substituting Characters in Many Files
    • Substituting Strings in Many Files
    • Tabulating the Count of Some Items
    • Truncating a File
    • Understanding variable=value on the Command Line
    • Unlinking Many Files Whose Names are Specified by Another Process
    • Untainting a Variable
  6. Real Perl Programs
    • Database Manipulation
      • lastlogin — Print Out Ancient Accounts
      • nfinger — Finger Through Mail Aliases File
      • flealist — Report on Status of Bugs
    • Grep Programs
      • tgrep — Scans Text Files
      • pipegrep — Scans Command Output
      • cgrep — Context Grep
    • Programming Aids
      • xdump — A Mainframe-ish Hex Dump
      • fixin — Fixes Interpreter Line on Incoming Scripts
      • retab — Shrink Indentation
      • w4 — Lists Dependencies
      • inctree — Prints Out #include Tree for C programs
      • lfix — Emulates ld -L Switch
      • nostrict — Postprocesses lint Output to Implement /* NOSTRICT */
      • exyacc — Extracts Grammar from yacc File
    • System Administration Stuff
      • passwd — Password Changing Program
      • pchelp — Lets People Gripe About Their PC
      • suidscript — Puts a C Wrapper Around a Setuid or Setgid Script
      • cleanup — News Expiration
      • fixscripts — Translate Files to Know About Scripts Directory
    • Filename Manipulation
      • rename — Renames Multiple Files
      • relink — Relinks Multiple Symbolic Links
      • sl — Show Translation of Symbolic Link to Actual Filename
      • lndir — Links Identical Files Between Directories
    • Text Manipulation Tools
      • wrapman — Turns a Perl Script Into Its Own Manual Page
      • wrapinst — Installs Manual Pages Produced by Running wrapman
      • reform — Reformats Paragraphs of Text
      • travesty — Writes a Parody of its Input
    • Processes
      • id — Print User and Group IDs of Current Shell Process
      • zap — Interactively Kill Processes Matching Pattern
      • dotime — Runs a Benchmark Program Several Times
      • START — Start Application Daemon Processes
      • KILL — Stop Application Daemons
    • Interprocess Communication
      • client — A Simple Sample Client
      • server — A Simple Sample Server
      • receptionist — An Internet Daemon Handler
  7. Other Oddments
    • Invocation Options
    • Debugging
    • Common Goofs for Novices
    • Efficiency
      • Time Efficiency
      • Space Efficiency
      • Programmer Efficiency
      • Maintainer Efficiency
      • Porter Efficiency
      • User Efficiency
    • Setuid Scripts
    • Distribution and Installation
      • Translation from awk and sed
      • Examples
      • Patches
      • Linking in C Subroutines with Perl
    • Perl Poetry
      • History Made Practical
  1. A Semi-Formal Description
  2. The Perl Library
    • abbrev.pl
    • bigint.pl
    • bigfloat.pl
    • bigrat.pl
    • cacheout.pl
    • complete.pl
    • ctime.pl
    • dumpvar.pl
    • flush.pl
    • getopt.pl
    • getopts.pl
    • importenv.pl
    • lock.pl
    • perldb.pl
    • pwd.pl
    • stat.pl
    • syslog.pl
    • termcap.pl
    • timelocal.pl
    • validate.pl

Reviews

Programming Perl

Reviewed by Roland Buresund

OK ***** (5 out of 10)

Last modified: March 21, 2022, 3:53 p.m.

The original Camel Book. It's an OK read, even through all bluster. Interesting for historical reasons.

Comments

There are currently no comments

New Comment

required

required (not published)

optional

required

captcha

required