hash-reference

What does `$hash{$key} |= {}` do in Perl?

I was wrestling with some Perl that uses hash references. In the end it turned out that my problem was the line: $myhash{$key} |= {}; That is, "assign $myhash{$key} a reference to an empty hash, unless it already has a value". Dereferencing this and trying to use it as a hash reference, however, resulted in interpreter errors about ...

What's the difference between a hash and hash reference in Perl?

I would like to properly understand hashes in Perl. I've had to use Perl intermittently for quite some time and mostly whenever I need to do it, it's mostly related to text processing. And everytime, I have to deal with hashes, it gets messed up. I find the syntax very cryptic for hashes A good explanation of hashes and hash references...