Perl variables come in seven types. You should be familiar with scalars, lists and hashes before you start this module, but you've probably still got more to learn. And how about code variables, file handles and typeglobs?
This topic is presented on public course
Perl for Larger Projects
Examples from our training material
| danger | What variables have I used? |
| dele | delete, undef, defined and exists |
| fact | recursion in Perl |
| mkd2 | Anonymous lists using [ and ] |
| mkpascal | Pascal's triangle; clever use of formatting |
| my2 | scoping with "my" |
| pers | persistent my variable |
| phash | data munging - unpack, splice, regular expressions etc |
| ref1 | References |
| ref2 | Modifying values passed in to a subroutine |
| ref3 | handling a list of lists element by element, by row, and as a whole |
| scal_type | ref function - what is in a scalar |
| scope | variable scope illustration |
| sfact | Beware of variable scope in recursive code |
| sfact1 | Use of strict to flag scoping dangers |
| sfact3 | Using package names to supress strict warnings |
| splitter | select and typeglobs for file handles - alternative to array of file handles |
| st | Accessing Perl's symbol tables |
| st2 | Dumping out all variables defined |
| tgd | typeglobs - a package deal (one of everything!) |
| vbn | Soft References |
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
Scalars, lists, hashes, code, file handles and typeglobs.
Symbol tables and accessing them.
Soft and hard references.
Undef and delete.
My and local scoping.
Strict.
References.
Multidimensional lists.
Dynamic creation of structures.
Anonymous data.
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.