4 ms·
It also helps to know that '=>' is really just syntactic sugar for a comma that also implicitly quotes the word to its left, and not a special operator for hash
by __david__ 11y ago
It also helps to know that '=>' is really just syntactic sugar for a comma that also implicitly quotes the word to its left, and not a special operator for hashes. These 2 lines are the same (in Perl 5):
%hash = (hello => 'there');
%hash = ('hello', 'there');
This is also perfectly valid (though non-idiomatic) Perl 5:
print Hello => ' ' => there => "\n";
- kbenson 11y agoYeah, I had quite a bit more in my reply originally, including that and code snippets with assignment back and forth between a hash and array, but decided I didn't need to turn this article into a Perl 5 tutorial ;)