4 ms·
Didn't perl always have multi-dimensional arrays? Just the syntax sugar for them is more recent.
by VVertigo 7y ago
Didn't perl always have multi-dimensional arrays?
Just the syntax sugar for them is more recent.
- simcop2387 7y agoNot quite, references were introduced in perl 5, in perl 4 and earlier had a different method that wasn't quite multi-dimensional arrays but tried to behave that way. $hash{1,2,3} = 10; This actually ends up doing the following $hash{join($;, 1, 2, 3)} = 10; It builds up a single key from the list using the special variable $; as a separator to the elements. With perl 5 you gained the ability to make references which allow you to actually make multiple dimensions and to do it on arrays, not just hashes. $array[1][2][3] = 10; That also allows for more complicated data structures and much easier ways to iterate through the structures.
- abacadaba 7y agohmm, it's been 4-5 years since i really did any perl but i remember it being way more confusing than that. maybe i was just a noob.
- deleted 7y ago[deleted]