go ahead... be a heretic | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
No, an array reference is a scalar:
Here, @array is an array, as indicated by the “@” sigil, and $array_ref is a scalar, as per the “$” sigil. The syntax @{ ... } takes an array reference (which must be a scalar), and dereferences it to get the array it references. Here is something to meditate on: In Perl, an array can contain any number of elements, but each element must be a scalar. So, to make complex data structures (like N-dimensional arrays or arrays of hashes) you need some way of getting non-scalars (arrays or hashes) to act as scalars so they can be elements in the larger array. Which is where references come in: they are scalars which can be used to access other things, and those other things can be non-scalars. In addition to the reading recommendations given above by other monks, you might want to check out the Monastery’s tutorial intro to references. Hope that helps, Athanasius <°(((>< contra mundum In reply to Re^3: A Simple Question From A Simple Man
by Athanasius
|
|