Skip to content

Commit dc154aa

Browse files
authored
Add examples using slices
1 parent c306960 commit dc154aa

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

doc/Type/Hash.pod6

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,13 @@ most idiomatic and unambiguous solution:
137137
lookup-user( %( name => "$person<firstName> $person<lastName>" ) );
138138
};
139139
140+
=head2 Slices
141+
142+
You can assign to multiple keys at the same time with a slice.
143+
144+
my %h; %h<a b c> = 2 xx *; %h.perl.say # {:a(2), :b(2), :c(2)}
145+
my %h; %h<a b c> = ^3; %h.perl.say # {:a(0), :b(1), :c(2)}
146+
140147
=head2 Non-string keys
141148
142149
By default keys in C<{ }> are forced to strings. To compose a hash with

0 commit comments

Comments
 (0)