- May be assigned in several ways
- Items bounded by parentheses and separated by commas
- Special => operator quotes the key
- Sublists are "flattened" into a single hash
my %dessert = ("pie", "apple", "cake", "carrot", "sorbet", "orange");
%dessert = (pie => "apple",
cake => "carrot",
sorbet => "orange"); # Same, but easier to read
my %ice_cream = (bowl => "chocolate", float => "root beer");
my %choices = (%dessert, %ice_cream);
print "I would like $choices{sorbet} sorbet.\n";
Output:
I would like orange sorbet.
|