File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -2281,30 +2281,32 @@ is not required for the very last routine/method).
2281
2281
<people of earth>; # (1) Start with the input
2282
2282
2283
2283
# Feed (left-to-right) with parentheses, read top-to-bottom
2284
- @result = (
2284
+ my @result = (
2285
2285
<people of earth> # (1) Start with the input
2286
2286
==> map({ .tc }) # (2) Capitalize the words
2287
2287
==> grep /<[PE]>/ # (3) Look for P or E
2288
2288
==> sort # (4) Sort, result is <Earth People>
2289
2289
);
2290
2290
2291
2291
# For illustration, method chaining equivalent, read top-to-bottom
2292
- @result =
2292
+ my @result =
2293
2293
<people of earth> # (1) Start with the input
2294
2294
.map({ .tc }) # (2) Capitalize the words
2295
2295
.grep(/<[PE]>/) # (3) Look for P or E
2296
2296
.sort; # (4) Sort, result is <Earth People>
2297
2297
2298
2298
# To assign without the need of parentheses use another feed operator
2299
- <people of earth>
2299
+ my @result =
2300
+ <people of earth>
2300
2301
==> map({ .tc })
2301
2302
==> grep /<[PE]>/
2302
2303
==> sort()
2303
2304
==> @result;
2304
2305
2305
2306
# It can be useful to capture a partial result, however, unlike
2306
2307
# the leftward feed operator, it does require parentheses or a semicolon
2307
- <people of earth>
2308
+ my @result =
2309
+ <people of earth>
2308
2310
==> map({ .tc })
2309
2311
==> my @caps; @caps # also could wrap in parentheses instead
2310
2312
==> grep /<[PE]>/
You can’t perform that action at this time.
0 commit comments