| 1 |
#!/usr/bin/perl |
| 2 |
|
| 3 |
# Copyright 2025-2026, Paul Johnson ([email protected]) |
| 4 |
|
| 5 |
# This software is free. It is licensed under the same terms as Perl itself. |
| 6 |
|
| 7 |
# The latest version of this software should be available from my homepage: |
| 8 |
# https://pjcj.net |
| 9 |
|
| 10 |
# __COVER__ skip_test $] < 5.041010 |
| 11 |
# __COVER__ skip_reason any/all not implemented |
| 12 |
|
| 13 |
use strict; |
| 14 |
use warnings; |
| 15 |
no warnings "experimental"; |
| 16 |
use feature "keyword_any"; |
| 17 |
use feature "keyword_all"; |
| 18 |
|
| 19 |
sub main { |
| 20 |
my $haystack = [ 1 .. 8 ]; |
| 21 |
print "any\n" if any { $_ % 2 } @$haystack; |
| 22 |
print "all\n" if all { $_ < 9 } @$haystack; |
| 23 |
} |
| 24 |
|
| 25 |
main |