in reply to Question about Perl refs and basic types
Well, because a reference can “refer to” more things than just “data.” References refer to things, if you will: to hashes, to blocks of code, to regular expressions, and so on.
Technically, if you want to get to the perlguts of the matter, within the interpreter there are various kinds of memory-blocks and each of these has (among other things) a reference-count. A “reference,” then, is one of those kinds of memory-blocks, whose purpose is to act as an indirect reference to something else. Each memory block has a type-indicator which says what kind of block it is, and that’s basically what drives the output of ref().
Why does it say SCALAR? Dunno. But, 11 out of 12 ain’t bad ...
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Question about Perl refs and basic types
by cheekuperl (Monk) on Jul 18, 2012 at 15:41 UTC | |
by Anonymous Monk on Jul 19, 2012 at 00:36 UTC |