logoalt Hacker News

pavel_lishinyesterday at 10:31 PM1 replyview on HN

I don't think it is, tbh.

Perl's hashes are a complete mystery to me still, but at least it lets me know that it's not just a linear, uh, well, array.


Replies

duskwuffyesterday at 11:35 PM

> Perl's hashes are a complete mystery to me still

They're unordered mappings from strings to arbitrary values ("scalars" in Perl jargon). In this sense they're just like an object in JavaScript.

Where this gets a little weird is that Perl arrays and hashes are fundamental types distinct from scalars - you can't put a hash into a $variable without taking a reference to it first, for instance. But that's more a matter of Perl being picker about the value/reference distinction than a hash-specific thing.