Python and Tcl - public course schedule [here]
Private courses on your site - see [here]
Please ask about maintenance training for Perl, PHP, Lua, etc
Adventure with references to lists and lists of references
I remember an old game I used to play on DEC 10 (and VAX and PDP-11) computers - the original
adventure game, perhaps ([see here]
) which was pure text / instruction based and you traveled North, South, East and West through the colossal cave. And there was one are - the maze - where you could get rather lost between a little maze of twisting passages, little maze of twisty passages, little twisty maze of passages, maze of little twisting passages, maze of little twisty passages, maze of twisting little passages, maze of twisty little passages, twisting little maze of passages, twisting maze of little passages, twisty little maze of passages and a twisty maze of little passages!
And I was reminded about that the other day when I was differentiating in Perl between a list of scalars, a list of references to scalars, and a reference to a list of scalars.
A series of scalars - held in a collections that's ordered (numbered from 0 upwards and sortable) is a list in Perl ... and you can create a list of scalars using round brackets:
@numbers = (10,20,30,40);
If you want to hold pointers / references / addresses of scalars rather than the scalars themselves in a list, you'll add an extra \ character:
@again = \(10,20,30,40);
In Perl terms, that looks like a single pointer to the list but it's not - it's an exception to the usual syntax, and it returns a whole list of pointers.
If you're really looking for a single pointer to a whole list, you'll use square brackets:
$further = [10,20,30,40];
A list of scalars (@numbers):
10 20 30 40
A list of references to scalars (@again):
SCALAR(0x100800f20) SCALAR(0x100800f30) SCALAR(0x100800f40) SCALAR(0x100800f50)
and a reference to a list (of scalars, but we can't tell that from the output) ($further):
There's an extended example - showing how hashes and references to hashes and context fits in too - [here]
. (written 2010-12-26, updated 2011-01-03)
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articlesP217 - Perl - More than Simple Lists and Hashes! 
Taking the lead, not the dog, for a walk. - (2012-10-28) 
How to do multidimensional arrays (or rather lists and hashes) in Perl - (2012-01-14) 
Take the dog on a lead - do not carry her. Perl references. - (2011-09-17) 
Not multidimentional arrays - but lists of lists. Much more flexible. Perl! - (2011-08-26) 
From fish, loaves and apples to money, plastic cards and BACS (Perl references explained) - (2011-08-20) 
Arrays of arrays - or 2D arrays. How to program tables. - (2011-01-02) 
Finding elements common to many lists / arrays - (2010-11-26) 
Setting up a matrix of data (2D array) for processing in your program - (2010-10-21) 
Copying - duplicating data, or just adding a name? Perl and Python compared - (2010-10-12) 
Further more advanced Perl examples - (2010-07-19) 
Just pass a pointer - do not duplicate the data - (2010-06-30) 
Perl references - $$var and \$var notations - (2009-06-15) 
Autovivification - the magic appearance of variables in Perl - (2008-01-21) 
Course follow-ups - (2005-04-27) 
Hash of lists in Perl - (2004-09-09)
Some other Articles
A weighty decisionMy First ChristmasHotel and Training Course prices - the effect of the VAT rise on 4th January 2011BucketsAdventure with references to lists and lists of referencesCatering in Syracuse, the Saigon Cafe, stolen images and ChristmasThank you - and Happy ChristmasAND and OR operators - what is the difference between logical and bitwise varieties?The week before ChristmasLooking ahead and behind in Regular Expressions - double matching
4759 posts, page by page
Link to page ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96 at 50 posts per page
This is a page archived from The Horse's Mouth at
the diary and writings of Graham Ellis.
Every attempt was made to provide current information at the time the
page was written, but things do move forward in our business - new software
releases, price changes, new techniques. Please check back via
our main site for current courses,
prices, versions, etc - any mention of a price in "The Horse's Mouth"
cannot be taken as an offer to supply at that price.
Link to Ezine home page (for reading).
Link to Blogging home page (to add comments).