Home Accessibility Courses Twitter The Mouth Facebook Resources Site Map About Us Contact
 
For 2021 - online Python 3 training - see ((here)).

Our plans were to retire in summer 2020 and see the world, but Coronavirus has lead us into a lot of lockdown programming in Python 3 and PHP 7.
We can now offer tailored online training - small groups, real tutors - works really well for groups of 4 to 14 delegates. Anywhere in the world; course language English.

Please ask about private 'maintenance' training for Python 2, Tcl, Perl, PHP, Lua, etc.
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 0xfe80. And we can look use it by using an extra $ character :
print $$stuffat;
which literally means "the contents of the contents of stuffat".


What use is this?

Lots ... not only for scalars, but for the addresses of lists too. If I write
$holder = \@biglist;
I have assigned a single scalar variable to point to what is potentially a huge dataset and (for starters) I can easily pass it around to various subs without the need to replicate the data.

Other languages have this concept - "pointer" - too. See & and * in C, and the use of & in PHP.
(written 2009-06-15, updated 2009-06-22)

 
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articles
P301 - Variables in Perl
  [975] Answering ALL the delegate's Perl questions - (2006-12-09)
  [1581] What is an lvalue? (Perl, C) - (2008-03-18)
  [1946] Variable Types in Perl - (2008-12-15)
  [2374] Lead characters on Perl variable names - (2009-08-24)
  [2877] Further more advanced Perl examples - (2010-07-19)
  [2972] Some more advanced Perl examples from a recent course - (2010-09-27)
  [3059] Object Orientation in an hour and other Perl Lectures - (2010-11-18)
  [3430] Sigils - the characters on the start of variable names in Perl, Ruby and Fortran - (2011-09-10)
  [4398] Accessing variables across subroutine boundaries - Perl, Python, Java and Tcl - (2015-01-18)
  [4608] Introspecion in Perl 6 - (2016-01-02)

P217 - Perl - More than Simple Lists and Hashes!
  [43] Hash of lists in Perl - (2004-09-09)
  [293] Course follow-ups - (2005-04-27)
  [1514] Autovivification - the magic appearance of variables in Perl - (2008-01-21)
  [2840] Just pass a pointer - do not duplicate the data - (2010-06-30)
  [2996] Copying - duplicating data, or just adding a name? Perl and Python compared - (2010-10-12)
  [3007] Setting up a matrix of data (2D array) for processing in your program - (2010-10-21)
  [3072] Finding elements common to many lists / arrays - (2010-11-26)
  [3105] Adventure with references to lists and lists of references - (2010-12-26)
  [3118] Arrays of arrays - or 2D arrays. How to program tables. - (2011-01-02)
  [3399] From fish, loaves and apples to money, plastic cards and BACS (Perl references explained) - (2011-08-20)
  [3406] Not multidimentional arrays - but lists of lists. Much more flexible. Perl! - (2011-08-26)
  [3444] Take the dog on a lead - do not carry her. Perl references. - (2011-09-17)
  [3577] How to do multidimensional arrays (or rather lists and hashes) in Perl - (2012-01-14)
  [3906] Taking the lead, not the dog, for a walk. - (2012-10-28)


Back to
How do I query a database (MySQL)?
Previous and next
or
Horse's mouth home
Forward to
So what is this thing called Perl that I keep harping on about?
Some other Articles
Client side (Applet) and Server side (Servlet) Graphics in Java
What should a web site cost you?
Changing a variable behaviour in Perl - tieing
So what is this thing called Perl that I keep harping on about?
Perl references - $$var and \$var notations
How do I query a database (MySQL)?
Cornerstone Cafe, Melksham
Handling nasty characters - Perl, PHP, Python, Tcl, Lua
Taking a pride in the community
Alumni - revisiting and supporting the old University
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 http://www.wellho.net/horse/ - 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).

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2021: 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.net/mouth/2241_Per ... tions.html • PAGE BUILT: Sun Oct 11 16:07:41 2020 • BUILD SYSTEM: JelliaJamb