File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,31 @@ here, but most should go in the L</Performance Enhancements> section.
27
27
28
28
[ List each enhancement as a =head2 entry ]
29
29
30
+ =head2 New C<any> and C<all> operators
31
+
32
+ A new experimental feature has been added, which adds two new list-processing
33
+ operators, C<any> and C<all>.
34
+
35
+ use v5.40;
36
+ use feature 'any_all';
37
+
38
+ my @numbers = ...
39
+
40
+ if(all { $_ % 2 == 0 } @numbers) {
41
+ say "All the numbers are even";
42
+ }
43
+
44
+ These operate similarly to C<grep> except that they only ever return true or
45
+ false, testing if any (or all) of the elements in the list make the testing
46
+ block yield true. Because of this they can short-circuit, avoiding the need
47
+ to test any further elements if a given element determines the eventual
48
+ result.
49
+
50
+ These are inspired by the same-named functions in the L<List::Util> module,
51
+ except that they are implemented as direct core operators, and thus perform
52
+ faster, and do not produce an additional subroutine call stack frame for
53
+ invoking the code block.
54
+
30
55
=head1 Security
31
56
32
57
XXX Any security-related notices go here. In particular, any security
You can’t perform that action at this time.
0 commit comments