3 ms·
So if it's an array, why isn't it @addresses?
by sloucher 5y ago
So if it's an array, why isn't it @addresses?
- eythian 5y agoIt's an array reference. If you replaced the [ ... ] with ( ... ) you'd have an array and use @. This is something I see people new to Perl struggle with, and I remember it taking me some time to grasp back in the day. It's pretty natural to me now, but I do feel it's something of a wart in the language.
- cutler 5y agoReferences are scalars in Perl. @$ dereferences an array ref and %$ derefs a hash ref. You can also reference a scalar in Perl and deref it with $$ but I never understood why you would want to.