SlideShare a Scribd company logo
NodeTop, Next:Preface, Previous:(dir), Up:(dir)
    Preface:
    Overview of Perl:
    Scalars:
    Arrays:
    Control Structures:
    Associative Arrays (Hashes):
    Advanced Control Structures:
    Input and Output:
    Regular Expressions:
    Subroutines:
    File Input and Output:
    Directories:
    File System Manipulation:
    Formats:
    Using Modules:
    Going Further:
    General Index:

      --- The Detailed Node Listing ---

      Preface
      Purpose of this Book:
      Contributors:
      Obtaining the Most Recent Version:
      Audience: Who should read this book?
      Material Covered: What does this book cover?
      Conventions Used in this Book: How do I read this book?
      Where to Find Perl Information: Where can I get more information?

      Overview of Perl
      Perl Background: History and Philosophy of Perl.
      A First Perl Program: A Simple Example.
      Running Perl on Your System: How to run Perl.
      Expression Evaluation: How Perl expressions are evaluated.
      Overview Exercises: Exercises to learn from.

      Perl Background
      The History of Perl: Historical information on Perl.
      Perl as a Natural Language: How Perl can be considered a ``natural language''.
      The Slogans: Some common sayings that might help a new programmer understand Perl.

      Running Perl on Your System
      Perl on a Unix-like System: Using Perl in a Unix-like environment.
      Perl on a Microsoft Windows System: Using Perl on a Microsoft system.
      The Online Perl Documentation: Finding the documentation that comes with Perl.




                                                                                            Page 1
   Scalars
   Strings: Using strings of characters in Perl.
   Numbers: Using numerical values in Perl.
   Scalar Variables: Storing scalar data into variables.
   Operators: Operators that work on scalar data.
   Output of Scalar Data:
   Special Variables: Special scalar variables to be aware of.
   Summary of Scalar Operators:
   Scalar Exercises: Exercises to learn from.

   Strings
   Single-quoted Strings:
   A Digression---The print Function:
   Double-quoted Strings:
   Here Document Strings:

   Single-quoted Strings
   Special Characters in Single-quoted Strings:
   Newlines in Single-quoted Strings:
   Examples of Illegal Single-quoted Strings:

   Double-quoted Strings
   Interpolation in Double-quoted Strings:
   Examples of Interpolation:
   Examples of Interpolation (ASCII Octal Values):
   Examples of Interpolation (ASCII Hex Values):
   Characters Requiring Special Consideration:

   Numbers
   Numeric Literals: Numeric values in Perl

   Numeric Literals
   Printing Numeric Literals: Using print with numeric literals

   Scalar Variables
   Scalar Interpolation: Expanding scalar variables in double-quoted strings
   Undefined Variables: Before a Variable has a value, It is undefined

   Operators
   Numerical Operators: Operators for numeric scalars
   Comparison Operators: Operators to compare scalars with each other
   Auto-Increment and Decrement:
   String Operators: Operators for string scalars

   Arrays
   The Semantics of Arrays:
   List Literals:
   Array Variables:



                                                                                Page 2
   Manipulating Arrays and Lists:
   Array Exercises:

   Array Variables
   Using Array Variables:
   Associated Scalars:

   Manipulating Arrays and Lists
   It Slices!:
   Functions:
   The Context (List vs. Scalar):
   Array Interpolation:

   Functions
   Arrays as Stacks:
   Arrays as Queues:

   Control Structures
   Blocks:
   A Digression---Truth Values:
   The if/unless Structures:
   The while/until Structures:
   The do while/until Structures:
   The for Structure:
   The foreach Structure:
   Control Structure Exercises:

   Associative Arrays (Hashes)
   What Is It?:
   Hash Variables:
   Hash Literals:
   Hash Functions:
   Slices:
   Context Considerations:
   Hash Exercises:

   Functions
   Keys and Values:
   Each:

   Advanced Control Structures
   last and next:
   redo:
   Labeled Blocks:
   Expression Modifiers and Boolean Structures:
   Advanced Control Structure Exercises:

   Input and Output



                                                   Page 3
   STDOUT:
   STDIN:
   STDERR:
   Reading Input:
   Printing and Output:
   Special Variables for I/O:
   I/O Exercises:

   Regular Expressions
   The Theory Behind It All:
   The Simple:
   Pattern Matching:
   Regular Expression Shortcuts:
   Regular Expression Exercises:

   The Simple
   Simple Characters:
   The * Special Character:
   The . Character:
   The | Character:
   Grouping with ()s:
   The Anchor Characters:

   Subroutines
   Defining Subroutines:
   Returning Values:
   Using Arguments:
   Dynamic vs. Lexical Scoping:
   Subroutine Exercises:

   File Input and Output
   Filehandles:
   Open and Close:
   Easy Input and Output with Filehandles:
   File Tests:
   The stat Function:
   File I/O Exercises:

   Directories
   Moving Around:
   Globbing:
   Directory Handles:
   Reading Directory Information:
   Directory Exercises:

   File System Manipulation
   Renaming and Removing:
   Creation:



                                              Page 4
   Permissions:
       Timestamps:
       File System Exercises:

       Formats
       Format Exercises:

       Using Modules
       The use Pragma:
       Importing Functions:
       Controlling What Is Imported:
       A Module Example (CGI.pm):
       Useful Default Modules:
       Downloading and Installing CPAN Modules:


NodePreface, Next:Overview of Perl, Previous:Top, Up:Top



  Preface
       Purpose of this Book:
       Contributors:
       Obtaining the Most Recent Version:
       Audience: Who should read this book?
       Material Covered: What does this book cover?
       Conventions Used in this Book: How do I read this book?
       Where to Find Perl Information: Where can I get more information?


NodePurpose of this Book, Next:Contributors, Previous:Preface, Up:Preface


 Purpose of this Book
 This book has been created for a number of reasons. The primary reason is to provide a freely
redistributable tutorial for the Perl language. In writing a freely redistributable tutorial, it is our hope that
the largest number of people can have access to it and share it.

We are a community of Perl programmers. We have discovered ways to save time and money by writing
Perl programs that make our jobs and lives easier. Surely, Perl is not a panacea, but it has certainly made
our lives a little bit easier. It is our hope that you can use Perl to make your jobs and lives easier.


NodeContributors, Next:Obtaining the Most Recent Version, Previous:Purpose of this Book, Up:
Preface


 Contributors
Bradley M. Kuhn (bkuhn@ebb.org) served as "pumpking" (aka editor) for the first edition of this book.



                                                                                                                    Page 5
In addition, he wrote most of the chapters for the first edition.

Greg Bacon (gbacon@cs.uah.edu) was the first to provide grammar and error correcting patches to the
early, pre-release editions.


NodeObtaining the Most Recent Version, Next:Audience, Previous:Contributors, Up:Preface


 Obtaining the Most Recent Version
This book is still under development. The most recent version can be obtained at
http://www.ebb.org/PickingUpPerl.


NodeAudience, Next:Material Covered, Previous:Obtaining the Most Recent Version, Up:Preface


 Audience
 This book is designed for readers who are already competent programmers. Perl is a wonderful
programming language, but is really not the best choice for a first programming language. Since that is the
case, we have chosen to write this book for the audience of those who are already familiar with general
programming concepts, but are completely new to Perl.

This book does not that assume any prior knowledge of Perl. However, a reader familiar with standard
computer science concepts such as abstraction, stacks, queues, and hash tables will definitely find her
way through this book with ease. In other words, anyone with a knowledge equivalent to a first-year of
college computer science courses should find this book very basic, and those of less experience may find
it much more challenging.


NodeMaterial Covered, Next:Conventions Used in this Book, Previous:Audience, Up:Preface


 Material Covered
 The material covered in this book is designed to prepare the reader to enter the world of Perl
programming. This book covers the basic data and control structures of Perl, as well as the philosophies
behind Perl programming. The native search patterns used in Perl, called regular expressions, are
introduced and discussed. The basics of input and output and file system manipulation in Perl are
explained. Finally, a "real world" example of working with and using modules that other programmers
have written is given.


NodeConventions Used in this Book, Next:Where to Find Perl Information, Previous:Material Covered,
Up:Preface


 Conventions Used in this Book
In this text, a variety of conventions will be used to explain the material. Certain typographical and
display elements will be used for didactic purposes.



                                                                                                              Page 6
Any Perl code that is included directly in flowing text appears like this: code. Any operating system
commands or files that are discussed directly in the flowing text appear like this: file. When a particularly
term of importance is first introduced, they appear in emphasized text, like this: an important term.

When Perl code examples or operating system commands need to be separated away from the flowing
text for emphasis, or because the code is long, it appears like this:
my $x = "foo";           # This is a Perl assignment
p




                                                                                                                Page 7

More Related Content

What's hot (20)

PDF
Os Harkins
oscon2007
 
PDF
Service-Oriented Integration With Apache ServiceMix
Bruce Snyder
 
PDF
Introducing RaveJS: Spring Boot concepts for JavaScript applications
John Hann
 
PDF
O que há de novo no Rails 3
Hugo Baraúna
 
PDF
Os Bunce
oscon2007
 
PDF
Converting Your Dev Environment to a Docker Stack - php[world]
Dana Luther
 
PPT
Introduction to Ruby on Rails
Manoj Kumar
 
PDF
Web Development with Python and Django
Michael Pirnat
 
PDF
Service Oriented Integration with ServiceMix
ghessler
 
PDF
Ndp Slides
oscon2007
 
PPTX
Apache servicemix1
manojkumar024
 
KEY
Apache httpd-2.4 : Watch out cloud!
Jim Jagielski
 
PDF
Service Oriented Integration With ServiceMix
Bruce Snyder
 
PDF
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory Course
peter_marklund
 
PDF
Converting Your Dev Environment to a Docker Stack - Cascadia
Dana Luther
 
PDF
Debugging on rails
Mykhaylo Sorochan
 
PDF
CMake: Improving Software Quality and Process
Marcus Hanwell
 
PDF
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...
bobmcwhirter
 
KEY
Ruby on Rails Training - Module 1
Mark Menard
 
Os Harkins
oscon2007
 
Service-Oriented Integration With Apache ServiceMix
Bruce Snyder
 
Introducing RaveJS: Spring Boot concepts for JavaScript applications
John Hann
 
O que há de novo no Rails 3
Hugo Baraúna
 
Os Bunce
oscon2007
 
Converting Your Dev Environment to a Docker Stack - php[world]
Dana Luther
 
Introduction to Ruby on Rails
Manoj Kumar
 
Web Development with Python and Django
Michael Pirnat
 
Service Oriented Integration with ServiceMix
ghessler
 
Ndp Slides
oscon2007
 
Apache servicemix1
manojkumar024
 
Apache httpd-2.4 : Watch out cloud!
Jim Jagielski
 
Service Oriented Integration With ServiceMix
Bruce Snyder
 
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory Course
peter_marklund
 
Converting Your Dev Environment to a Docker Stack - Cascadia
Dana Luther
 
Debugging on rails
Mykhaylo Sorochan
 
CMake: Improving Software Quality and Process
Marcus Hanwell
 
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...
bobmcwhirter
 
Ruby on Rails Training - Module 1
Mark Menard
 

Viewers also liked (6)

PDF
YouDrup_in_Drupal
tutorialsruby
 
PDF
backend
tutorialsruby
 
PDF
newperl5
tutorialsruby
 
PDF
d_vbp_print
tutorialsruby
 
PDF
hw1a
tutorialsruby
 
PDF
TemplateTutorial
tutorialsruby
 
YouDrup_in_Drupal
tutorialsruby
 
backend
tutorialsruby
 
newperl5
tutorialsruby
 
d_vbp_print
tutorialsruby
 
TemplateTutorial
tutorialsruby
 
Ad

Similar to Perl%20Tutorial.!Picking%20Up%20Perl (20)

PDF
Modules of the twenties
Puppet
 
PPTX
Introduction to Linux Slides.pptx
hazhamina
 
PDF
What we can learn from Rebol?
lichtkind
 
PPT
presentation_intro_to_python
gunanandJha2
 
PPT
presentation_intro_to_python_1462930390_181219.ppt
MohitChaudhary637683
 
PDF
Lpi Part 2 Basic Administration
YemenLinux
 
PDF
OOP, Networking, Linux/Unix
Novita Sari
 
PDF
The Why and What of Pattern Lab
Dave Olsen
 
PPTX
The Bund language
Vladimir Ulogov
 
PPT
web programming Unit VI PPT by Bhavsingh Maloth
Bhavsingh Maloth
 
PDF
The Rust Programming Language 2nd Edition Steve Klabnik
onutaithakut25
 
PDF
The Rust Programming Language Steve Klabnik
nmiriorola
 
PDF
The Rust Programming Language 2nd Edition Steve Klabnik
urbuuawara
 
PDF
The Rust Programming Language, Second Edition Steve Klabnik
killrnleiffi
 
PPTX
Managing JSON Deliverables with Fuzzy String-Matching Logic and the Path Reader
Safe Software
 
PPTX
Summer Training Project On Python Programming
KAUSHAL KUMAR JHA
 
PDF
Download Complete The Rust Programming Language 2nd Edition Steve Klabnik PDF...
maggannawsad
 
PDF
Linux programming - Getting self started
Emertxe Information Technologies Pvt Ltd
 
PPTX
File handle in PROGRAMMable extensible interpreted .pptx
urvashipundir04
 
PPTX
Avro
Eric Turcotte
 
Modules of the twenties
Puppet
 
Introduction to Linux Slides.pptx
hazhamina
 
What we can learn from Rebol?
lichtkind
 
presentation_intro_to_python
gunanandJha2
 
presentation_intro_to_python_1462930390_181219.ppt
MohitChaudhary637683
 
Lpi Part 2 Basic Administration
YemenLinux
 
OOP, Networking, Linux/Unix
Novita Sari
 
The Why and What of Pattern Lab
Dave Olsen
 
The Bund language
Vladimir Ulogov
 
web programming Unit VI PPT by Bhavsingh Maloth
Bhavsingh Maloth
 
The Rust Programming Language 2nd Edition Steve Klabnik
onutaithakut25
 
The Rust Programming Language Steve Klabnik
nmiriorola
 
The Rust Programming Language 2nd Edition Steve Klabnik
urbuuawara
 
The Rust Programming Language, Second Edition Steve Klabnik
killrnleiffi
 
Managing JSON Deliverables with Fuzzy String-Matching Logic and the Path Reader
Safe Software
 
Summer Training Project On Python Programming
KAUSHAL KUMAR JHA
 
Download Complete The Rust Programming Language 2nd Edition Steve Klabnik PDF...
maggannawsad
 
Linux programming - Getting self started
Emertxe Information Technologies Pvt Ltd
 
File handle in PROGRAMMable extensible interpreted .pptx
urvashipundir04
 
Ad

More from tutorialsruby (20)

PDF
<img src="../i/r_14.png" />
tutorialsruby
 
PDF
TopStyle Help & <b>Tutorial</b>
tutorialsruby
 
PDF
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting <b>...</b>
tutorialsruby
 
PDF
<img src="../i/r_14.png" />
tutorialsruby
 
PDF
<img src="../i/r_14.png" />
tutorialsruby
 
PDF
Standardization and Knowledge Transfer – INS0
tutorialsruby
 
PDF
xhtml_basics
tutorialsruby
 
PDF
xhtml_basics
tutorialsruby
 
PDF
xhtml-documentation
tutorialsruby
 
PDF
xhtml-documentation
tutorialsruby
 
PDF
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
tutorialsruby
 
PDF
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
tutorialsruby
 
PDF
HowTo_CSS
tutorialsruby
 
PDF
HowTo_CSS
tutorialsruby
 
PDF
BloggingWithStyle_2008
tutorialsruby
 
PDF
BloggingWithStyle_2008
tutorialsruby
 
PDF
cascadingstylesheets
tutorialsruby
 
PDF
cascadingstylesheets
tutorialsruby
 
<img src="../i/r_14.png" />
tutorialsruby
 
TopStyle Help & <b>Tutorial</b>
tutorialsruby
 
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting <b>...</b>
tutorialsruby
 
<img src="../i/r_14.png" />
tutorialsruby
 
<img src="../i/r_14.png" />
tutorialsruby
 
Standardization and Knowledge Transfer – INS0
tutorialsruby
 
xhtml_basics
tutorialsruby
 
xhtml_basics
tutorialsruby
 
xhtml-documentation
tutorialsruby
 
xhtml-documentation
tutorialsruby
 
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
tutorialsruby
 
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
tutorialsruby
 
HowTo_CSS
tutorialsruby
 
HowTo_CSS
tutorialsruby
 
BloggingWithStyle_2008
tutorialsruby
 
BloggingWithStyle_2008
tutorialsruby
 
cascadingstylesheets
tutorialsruby
 
cascadingstylesheets
tutorialsruby
 

Recently uploaded (20)

PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PPTX
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PDF
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PDF
July Patch Tuesday
Ivanti
 
PDF
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PDF
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
July Patch Tuesday
Ivanti
 
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 

Perl%20Tutorial.!Picking%20Up%20Perl

  • 1. NodeTop, Next:Preface, Previous:(dir), Up:(dir)  Preface:  Overview of Perl:  Scalars:  Arrays:  Control Structures:  Associative Arrays (Hashes):  Advanced Control Structures:  Input and Output:  Regular Expressions:  Subroutines:  File Input and Output:  Directories:  File System Manipulation:  Formats:  Using Modules:  Going Further:  General Index:  --- The Detailed Node Listing ---  Preface  Purpose of this Book:  Contributors:  Obtaining the Most Recent Version:  Audience: Who should read this book?  Material Covered: What does this book cover?  Conventions Used in this Book: How do I read this book?  Where to Find Perl Information: Where can I get more information?  Overview of Perl  Perl Background: History and Philosophy of Perl.  A First Perl Program: A Simple Example.  Running Perl on Your System: How to run Perl.  Expression Evaluation: How Perl expressions are evaluated.  Overview Exercises: Exercises to learn from.  Perl Background  The History of Perl: Historical information on Perl.  Perl as a Natural Language: How Perl can be considered a ``natural language''.  The Slogans: Some common sayings that might help a new programmer understand Perl.  Running Perl on Your System  Perl on a Unix-like System: Using Perl in a Unix-like environment.  Perl on a Microsoft Windows System: Using Perl on a Microsoft system.  The Online Perl Documentation: Finding the documentation that comes with Perl. Page 1
  • 2. Scalars  Strings: Using strings of characters in Perl.  Numbers: Using numerical values in Perl.  Scalar Variables: Storing scalar data into variables.  Operators: Operators that work on scalar data.  Output of Scalar Data:  Special Variables: Special scalar variables to be aware of.  Summary of Scalar Operators:  Scalar Exercises: Exercises to learn from.  Strings  Single-quoted Strings:  A Digression---The print Function:  Double-quoted Strings:  Here Document Strings:  Single-quoted Strings  Special Characters in Single-quoted Strings:  Newlines in Single-quoted Strings:  Examples of Illegal Single-quoted Strings:  Double-quoted Strings  Interpolation in Double-quoted Strings:  Examples of Interpolation:  Examples of Interpolation (ASCII Octal Values):  Examples of Interpolation (ASCII Hex Values):  Characters Requiring Special Consideration:  Numbers  Numeric Literals: Numeric values in Perl  Numeric Literals  Printing Numeric Literals: Using print with numeric literals  Scalar Variables  Scalar Interpolation: Expanding scalar variables in double-quoted strings  Undefined Variables: Before a Variable has a value, It is undefined  Operators  Numerical Operators: Operators for numeric scalars  Comparison Operators: Operators to compare scalars with each other  Auto-Increment and Decrement:  String Operators: Operators for string scalars  Arrays  The Semantics of Arrays:  List Literals:  Array Variables: Page 2
  • 3. Manipulating Arrays and Lists:  Array Exercises:  Array Variables  Using Array Variables:  Associated Scalars:  Manipulating Arrays and Lists  It Slices!:  Functions:  The Context (List vs. Scalar):  Array Interpolation:  Functions  Arrays as Stacks:  Arrays as Queues:  Control Structures  Blocks:  A Digression---Truth Values:  The if/unless Structures:  The while/until Structures:  The do while/until Structures:  The for Structure:  The foreach Structure:  Control Structure Exercises:  Associative Arrays (Hashes)  What Is It?:  Hash Variables:  Hash Literals:  Hash Functions:  Slices:  Context Considerations:  Hash Exercises:  Functions  Keys and Values:  Each:  Advanced Control Structures  last and next:  redo:  Labeled Blocks:  Expression Modifiers and Boolean Structures:  Advanced Control Structure Exercises:  Input and Output Page 3
  • 4. STDOUT:  STDIN:  STDERR:  Reading Input:  Printing and Output:  Special Variables for I/O:  I/O Exercises:  Regular Expressions  The Theory Behind It All:  The Simple:  Pattern Matching:  Regular Expression Shortcuts:  Regular Expression Exercises:  The Simple  Simple Characters:  The * Special Character:  The . Character:  The | Character:  Grouping with ()s:  The Anchor Characters:  Subroutines  Defining Subroutines:  Returning Values:  Using Arguments:  Dynamic vs. Lexical Scoping:  Subroutine Exercises:  File Input and Output  Filehandles:  Open and Close:  Easy Input and Output with Filehandles:  File Tests:  The stat Function:  File I/O Exercises:  Directories  Moving Around:  Globbing:  Directory Handles:  Reading Directory Information:  Directory Exercises:  File System Manipulation  Renaming and Removing:  Creation: Page 4
  • 5. Permissions:  Timestamps:  File System Exercises:  Formats  Format Exercises:  Using Modules  The use Pragma:  Importing Functions:  Controlling What Is Imported:  A Module Example (CGI.pm):  Useful Default Modules:  Downloading and Installing CPAN Modules: NodePreface, Next:Overview of Perl, Previous:Top, Up:Top Preface  Purpose of this Book:  Contributors:  Obtaining the Most Recent Version:  Audience: Who should read this book?  Material Covered: What does this book cover?  Conventions Used in this Book: How do I read this book?  Where to Find Perl Information: Where can I get more information? NodePurpose of this Book, Next:Contributors, Previous:Preface, Up:Preface Purpose of this Book This book has been created for a number of reasons. The primary reason is to provide a freely redistributable tutorial for the Perl language. In writing a freely redistributable tutorial, it is our hope that the largest number of people can have access to it and share it. We are a community of Perl programmers. We have discovered ways to save time and money by writing Perl programs that make our jobs and lives easier. Surely, Perl is not a panacea, but it has certainly made our lives a little bit easier. It is our hope that you can use Perl to make your jobs and lives easier. NodeContributors, Next:Obtaining the Most Recent Version, Previous:Purpose of this Book, Up: Preface Contributors Bradley M. Kuhn ([email protected]) served as "pumpking" (aka editor) for the first edition of this book. Page 5
  • 6. In addition, he wrote most of the chapters for the first edition. Greg Bacon ([email protected]) was the first to provide grammar and error correcting patches to the early, pre-release editions. NodeObtaining the Most Recent Version, Next:Audience, Previous:Contributors, Up:Preface Obtaining the Most Recent Version This book is still under development. The most recent version can be obtained at http://www.ebb.org/PickingUpPerl. NodeAudience, Next:Material Covered, Previous:Obtaining the Most Recent Version, Up:Preface Audience This book is designed for readers who are already competent programmers. Perl is a wonderful programming language, but is really not the best choice for a first programming language. Since that is the case, we have chosen to write this book for the audience of those who are already familiar with general programming concepts, but are completely new to Perl. This book does not that assume any prior knowledge of Perl. However, a reader familiar with standard computer science concepts such as abstraction, stacks, queues, and hash tables will definitely find her way through this book with ease. In other words, anyone with a knowledge equivalent to a first-year of college computer science courses should find this book very basic, and those of less experience may find it much more challenging. NodeMaterial Covered, Next:Conventions Used in this Book, Previous:Audience, Up:Preface Material Covered The material covered in this book is designed to prepare the reader to enter the world of Perl programming. This book covers the basic data and control structures of Perl, as well as the philosophies behind Perl programming. The native search patterns used in Perl, called regular expressions, are introduced and discussed. The basics of input and output and file system manipulation in Perl are explained. Finally, a "real world" example of working with and using modules that other programmers have written is given. NodeConventions Used in this Book, Next:Where to Find Perl Information, Previous:Material Covered, Up:Preface Conventions Used in this Book In this text, a variety of conventions will be used to explain the material. Certain typographical and display elements will be used for didactic purposes. Page 6
  • 7. Any Perl code that is included directly in flowing text appears like this: code. Any operating system commands or files that are discussed directly in the flowing text appear like this: file. When a particularly term of importance is first introduced, they appear in emphasized text, like this: an important term. When Perl code examples or operating system commands need to be separated away from the flowing text for emphasis, or because the code is long, it appears like this: my $x = "foo"; # This is a Perl assignment p Page 7