Comment by dominicrose
5 hours ago
Whenever Perl encounters a string literal in the code (especially one used as a hash key or a bareword), it often "interns" it. This means it stores a single, canonical, read-only copy of that string in a memory pool.
That's the core idea, and then Ruby has surface stuff like the symbol syntax and class. I'm pretty sure it's fine to use strings as hash keys though if you like.
> I'm pretty sure it's fine to use strings as hash keys though if you like.
Sure. They are just less efficient as hash keys.
Although now the distinction blurs with frozen strings (and the string literals being frozen by default switch).