Hash (%)
Key-value mapping.
Syntax
my %h = (key => value);
Description
Hashes are defined with %. Values are accessed with $h{key} (using the $ sigil). keys returns the keys.
Example
Loading editor…
Expected output
Alex
When to use?
Structured data.
Common mistakes
- ⚠️ Values are accessed with $h{key} (sigil $ not %).