Perl Snippets
Below are a set of simple programs that demonstrate some basic functionality of the Perl programming language. Each program provides a simple example of how a single feature of Perl works.Each program can either be scanned or actually run. Click on the link to look at the program. To run one, download the file, make it executable for your own machine (Change the permissions so you can execute it, and, if it's Windows or some non-Linux operating system, change the path in the first line to where your copy of Perl is).
Keep in mind, nothing much happens when you actually run one of these programs. Mostly, they print out poetry. The idea is that if you want to tinker with the program itself, to explore how each feature works, then you have a working program to start with.
ARGV Input: (Program), (Text File)
Reading a File: (Program), (Text File)
File Handles: (Program), (Text File) (Sample File)
User-Supplied File Name: (Program), (Text File)
ForEach Loop: (Program), (Text File)
IfElse Loop: (Program), (Text File)
While Loop: (Program), (Text File)
Array Basics: (Program), (Text File)
Subroutines: (Program), (Text File)
Passing An Array To A Subroutine: (Program), (Text File)
Multidimensional Array Sort: (Program), (Text File)
Hashes: (Program), (Text File)
Regular Expressions: (Program), (Text File)
Reverse Operator: (Program), (Text File)
Fomratting: (Program), (Text File)
Reverse Operators: (Program), (Text File)
Date Parsing: (Program), (Text File)
Converting a Timestamp: (Program), (Text File)
Connecting To A Database and Running a SQL query: (Program), (Text File)
Saving the results of a SQL query in an array: (Program), (Text File)
Perl Resources