@@ -1177,6 +1177,9 @@ Defined as:
1177
1177
Calls method L < C < pop > |/routine/pop> on the container, which is supposed to
1178
1178
remove and return the last element, or fail if the container is empty.
1179
1179
1180
+ See the documentation of the L < C < Array > method|/type/Array#method_pop> for an
1181
+ example.
1182
+
1180
1183
= head2 sub shift
1181
1184
1182
1185
Defined as:
@@ -1186,6 +1189,14 @@ Defined as:
1186
1189
Calls method L < C < shift > |/routine/shift> on the container which is supposed to
1187
1190
remove and return the first element, or fail if the container is empty.
1188
1191
1192
+ Example:
1193
+
1194
+ my @foo = <a b>;
1195
+ while my $value = shift @foo {
1196
+ say $value;
1197
+ }
1198
+ # OUTPUT: «ab»
1199
+
1189
1200
= head2 sub push
1190
1201
1191
1202
Defined as:
@@ -1202,6 +1213,9 @@ add C<b> or the values in C<|@b> to the end of an array. If C<b> is a C<Slip>,
1202
1213
the container is supposed to add the values produced by
1203
1214
L < C < b.iterator > |/routine/iterator> .
1204
1215
1216
+ See the documentation of the L < C < Hash > method|/type/Hash#method_push> for an
1217
+ example where the subroutine form is useful.
1218
+
1205
1219
= head2 sub append
1206
1220
1207
1221
Defined as:
@@ -1224,9 +1238,10 @@ values of a C<Hash>. Whereas L<method append|/type/Hash#method_append> will
1224
1238
silently ignore literal pairs that are interpreted as named arguments, sub
1225
1239
C < append > will throw:
1226
1240
1227
- CATCH { default { put .message } };
1228
1241
my %h = i => 0;
1229
- append %h, i => (1, 42); # OUTPUT: «Unexpected named argument 'i' passed»
1242
+ append %h, i => (1, 42);
1243
+ CATCH { default { put .message } };
1244
+ # OUTPUT: «Unexpected named argument 'i' passed»
1230
1245
1231
1246
= head1 Control routines
1232
1247
0 commit comments