3 ms·
The sigil represents the type of the thing you're accessing, not the type of where it comss from. $ means a scalar (number, string, reference) @ means an arra
by toast0 4y ago
The sigil represents the type of the thing you're accessing, not the type of where it comss from.
$ means a scalar (number, string, reference)
@ means an array/list
% means a hash (also known in other languages as a map, associative array, etc)
A list item and hash keys and values are all scalars. So the array is @foo, but the items are $foo[0], etc. References get a bit ugly if you need to access a whole container whose reference is stored in another container, and also if references are used gratiutously: I've worked in code where no arrays or hashes were used, only ArrayRefs and HashRefs, ugh.