For 2023 - we are now fully retired from IT training. We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.
Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!
I am also active in many other area and still look after a lot of web sites - you can find an index ((here)) |

Well House Consultants
You are on the site of
Well House Consultants
who provide
Open Source Training Courses
and business
hotel accommodation. You are welcome to browse and use
our resources subject to our copyright statement and to add in links from your pages to ours.
Other subject areas - resources
Java Resources
Well House Manor Resources
Perl Resources
Python Resources
PHP Resources
Object Orientation and General topics
MySQL Resources
Linux / LAMP / Tomcat Resources
Well House Consultants Resources
Extras Resources
C and C++ Resources
Ruby Resources
Tcl/Tk Resources
Web and Intranet Resources
|
Perl module P301
Variables in Perl
Exercises, examples and other material relating to training module P301. This topic is presented on public course Perl for Larger Projects
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?
Articles and tips on this subject | updated | 4608 | Introspecion in Perl 6 Perl 6 provides introspection - that's the ability for its object to be able to report on methods, attributes and inheritances.
And if you run Perl6 without an input file, it goes into a read - interpret - run cycle with each line you type in, rather like Python, Ruby and Tcl do. So we can experiment ... | 2016-01-02 | 4398 | Accessing variables across subroutine boundaries - Perl, Python, Java and Tcl In a perfect programming world, code is broken into named blocks (methods, functions, subroutines, classes, procedures, commands, modules, packages etc) and data is passed around between the blocks purely as parameters and return values. And variables are local to the block in which they're used. This ... | 2015-01-18 | 3430 | Sigils - the characters on the start of variable names in Perl, Ruby and Fortran A sigil (from Latin sigillum "seal") is a symbol created for a specific magical purpose. A sigil is usually made up of a complex combination of several specific symbols or geometric figures, each with a specific meaning or intent. In computer programming, a sigil is a special symbol attached to a variable ... | 2011-09-10 | 3059 | Object Orientation in an hour and other Perl Lectures I enjoy the occasional course that's different in its design and specification, and yesterday was one of those - more lectures that training, on intermediate and advanced Perl, for a group of eight delegates who were all well experienced at PHP, but Perl "dabblers" to this point. During the day, we ... | 2010-12-04 | 2972 | Some more advanced Perl examples from a recent course I ran an extra Perl for larger projects course, single company, at the tail end of last week and into the weekend (the only gap in my diary for a few weeks!) and - as is often the case on single-company courses - I wrote some new illustrative code to show specific subjects that came up in a different ... | 2010-09-27 | 2877 | Further more advanced Perl examples I've uploaded a further batch of new examples (that makes around 40 in total!) from the private Perl course that I ran from Wednesday through Saturday last week - many of them adding a new twist on to previous examples. If you read a comment below and thing "that's what I'm looking for an example of", ... | 2010-07-30 (longer) | 1946 | Variable Types in Perl In Perl, you have "autovivification" where variables are created when they have a values set in them, without the need to declare them. Some authorities will tell you that they are also "autotyped" in that Perl knows what to store in them automatically too, and to some extent that's true ... but the ... | 2010-06-23 | 2374 | Lead characters on Perl variable names Perl variable names mostly start with a special character:
$ for a scalar variable - that's a variable that can hold an integer, a float, a string, a reference, or a compiled regular expression (that last not being terribly common).
@ for a list - that's an ordered collection of scalars, indexed from ... | 2009-08-26 (longer) | 2241 | Perl references - $$var and \$var notations In Perl, if I write:
$stuff = "Porridge";
then I'm setting up a variable to contain the value "Porridge".
If I write:
$stuffat = \$stuff;
then I'm setting up a variable to contain the ADDRESS OF the variable $stuff.
So if $stuff was in memory at (hex)fe80 ... then $stuffat will be assigned that value ... | 2009-06-22 | 1581 | What is an lvalue? (Perl, C) An lvalue is an expression that you can write on the left hand side of an assignment statement - in other words an expression that defines a specific memory address of a variable.
The most common lvalues are simple variables or array / list / hash / dictionary members ... for example
$hello = "Hello ... | 2008-03-18 | 975 | Answering ALL the delegate's Perl questions During courses, questions arise. "I'll get back to that" could make people feel that I'm brushing something off ... except that I explain, early on, that some questions require a great deal of background knowledge to be answered sensibly. And I keep a list of topics that I'll be getting back to ... | 2006-12-09 |
Examples from our training material
danger | What variables have I used? | dele | delete, undef, defined and exists | fact | recursion in Perl | gawd | Typeglob - one each of file handle, scalar, hash and list | henry | Variable types | iiw | my, local and global variables | mkd2 | Anonymous lists using [ and ] | mkpascal | Pascal's triangle; clever use of formatting | my2 | scoping with "my" | myscope | Scoping of our and my variables | 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!) | ty | Setting up and exercising a typeglob | vartypedemo | 6 variable types in Perl | 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 [here].
Topics covered in this module
Variable types. Scalars. Lists. Hashes. Code. File Handles. Typeglobs. Symbol Tables. Soft references. undef and delete. Variable scope. local variables. my variables. Further examples using my variables. strict. References. Using a reference within a subroutine. 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
Ruby,
Lua,
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 700 books on the subjects on which we teach.
These books are available for reference at our training centre.
|
|
|