From e8296c2d49218c31ba289ecd4105d51c9dcd6cd7 Mon Sep 17 00:00:00 2001 From: "Paul \"LeoNerd\" Evans" Date: Mon, 25 Nov 2024 21:21:51 +0000 Subject: [PATCH] perldelta --- pod/perldelta.pod | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/pod/perldelta.pod b/pod/perldelta.pod index 513e65dda10b2..4997ed4b30bf0 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -41,6 +41,31 @@ similar to the way that C<:reader> already creates reader accessors. my $p = Point->new( x => 20, y => 40 ); $p->set_x(60); +=head2 New C and C operators + +A new experimental feature has been added, which adds two new list-processing +operators, C and C. + + use v5.40; + use feature 'any_all'; + + my @numbers = ... + + if(all { $_ % 2 == 0 } @numbers) { + say "All the numbers are even"; + } + +These operate similarly to C except that they only ever return true or +false, testing if any (or all) of the elements in the list make the testing +block yield true. Because of this they can short-circuit, avoiding the need +to test any further elements if a given element determines the eventual +result. + +These are inspired by the same-named functions in the L module, +except that they are implemented as direct core operators, and thus perform +faster, and do not produce an additional subroutine call stack frame for +invoking the code block. + =head1 Security XXX Any security-related notices go here. In particular, any security