Not all Perl variables are created as you run your code. Some useful information is provided in special variables before your code is even reached, and some of these special variables can be manipulated to affect the ongoing operation of your program. Perl even provides a facility that lets you leave parameters out of your source code, and it will assume a default current variable. This is known as topicalization.
This topic is presented on public courses
Perl Programming,
Perl bootcamp
Examples from our training material
| allhosts | Special variable $/; reading whole file to scalar |
| cl2 | Program that generates a warning |
| commline | Handling the command line via @ARGV |
| cv | rewrite of "dos2unix" in Perl |
| gop | Handling the command line via Getopt. Also Usage lines. |
| hodo | Filter looking for IP addresses of computer(s) with "tea" in name |
| infovars | English and short names for informational special variables |
| oddgrep | Using grep and map with $_ |
| paws | Progress bar / progress reports |
| rqu | Use of awk-like options with Perl |
| sample | Filter - takes names and attempts to capitalise correctly |
| special1 | Program using a variety of special variables |
| spout | Special variables to control output formatting of lists |
| ticker | Clock, using autoflush to update screen every second |
| top3 | Further use of $_ |
| topic1 | Variable used many times - candidate for topicalisation |
| topic2 | Topicalisation in use |
Opentalk forum discussions related to this topic
Brain Hurts Forcing PERL to write to a logfilreplace text in a large text fileQuestion regardingExtracting some fields from a data FileDialling codes for Ireland a quick Perl Script
Pictures
At the hotel at Dharhan International Airport
An on site course in early 2004
Background information
You may
download this module as a sample of our material
Topics covered in this module
Command-line parameters and the name of your program.
Informational variables.
Behaviour-changing variables.
$_ - the default input and pattern matching variable.
More command-line options.
Complete learning
If you are looking for a complete course and not just a information on a single subject, visit our
Listing and schedule page.
Well House Consultants specialise in training courses in
Python,
Perl,
PHP, and
MySQL. We run
Private Courses throughout the UK (and beyond for longer courses), and
Public Courses at our training centre in Melksham, Wiltshire, England.
It's surprisingly cost effective to come on our public courses -
even if
you live in a different
country or continent to us.
We have a technical library of over 600 books on the subjects on which we teach.
These books are available for reference at our training centre. Also
available is the Opentalk
Forum for discussion of technical questions.