Debian Codegraph @

cpan/Scalar-List-Utils/t/rt-96343.t

raw
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 use Test::More tests => 2;
7
8 {
9 use List::Util qw( first );
10
11 my $hash = {
12 'HellO WorlD' => 1,
13 };
14
15 is( ( first { 'hello world' eq lc($_) } keys %$hash ), "HellO WorlD",
16 'first (lc$_) perserves value' );
17 }
18
19 {
20 use List::Util qw( any );
21
22 my $hash = {
23 'HellO WorlD' => 1,
24 };
25
26 my $var;
27
28 no warnings 'void';
29 any { lc($_); $var = $_; } keys %$hash;
30
31 is( $var, 'HellO WorlD',
32 'any (lc$_) leaves value undisturbed' );
33 }