A list is a collection of scalars. If you know any other programming languages, you might think this sounds like an array. It does Ð it can do everything that an array can do, and much more too.
This topic is presented on public courses
Perl Programming,
Perl bootcamp
Examples from our training material
| booklook | chomp, grep, split, unshift and join example |
| c1 | Context, and splitting a list into named scalars |
| cont2 | List, scalar and double quote contexts |
| context | context demonstration |
| dmore | dicey list sample answer |
| dow | Anonymous list example |
| fanlist | List functions such as chomp and push in use |
| li1 | First example of a list |
| li2 | looping through a list |
| linelen | Using a list to count records of various lengths |
| odd | Shuffling a list |
| prog.pl | Iterating through a list |
| prog2.pl | mapping a list, iterating a list with your own counter |
| sal2 | Context examples |
| salad | setting up lists, looping through lists, list slices |
| vgrep | Verbose grep - illustration of list slices |
Opentalk forum discussions related to this topic
Using Grep to search through an arrayOperating on every scalar in a listHow to split a file but not line by lineContext
Pictures
Chocolate bar fun on a Perl course
Students undertake a Perl practical
With a Perl class in Saudi Arabia
Background information
Some modules are
available for download as a sample of our material or under an
Open Training Notes License for free download from
http://www.training-notes.co.uk.
Topics covered in this module
Basics.
Creating a list.
Referencing an element in a list.
Changing a list.
The length of a list.
Context.
Summary.
Functions that operate on lists.
Functions that let you manipulate the elements within a list.
Functions that let you re-order a list (returning a new list).
Function to return the length of a list.
Operators that relate to lists.
Operators than manipulate strings and lists.
Iterating through a list.
List slices.
Anonymous lists.
Summary.
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.