From e645f40f63d40ac8e429df9aa1b97b17a83355a8 Mon Sep 17 00:00:00 2001 From: "Paul \"LeoNerd\" Evans" Date: Fri, 22 Nov 2024 21:07:02 +0000 Subject: [PATCH] perldelta --- pod/perldelta.pod | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/pod/perldelta.pod b/pod/perldelta.pod index 3ce40a3b49c03..7a52e94cd08d7 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -27,6 +27,31 @@ here, but most should go in the L section. [ List each enhancement as a =head2 entry ] +=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