Hmmmm... Perl v5.20:
$ perl -MList::Util=first -le 'print first {lc eq "abc"} keys %{{ABC=>"ABC"}}' abc $ perl -MList::Util=first -le 'print first {uc eq "ABC"} keys %{{ABC=>"ABC"}}' ABC $ perl -MList::Util=first -le 'print first {/abc/i} keys %{{ABC=>"ABC"}}' ABC $ perl -MList::Util=first -le 'print first {lc eq "abc"} values %{{ABC=>"ABC"}}' ABC $ perl -MList::Util=first -le 'print first {lc eq "abc"} "ABC"' ABC $ perl -MList::Util=first -le 'print first {lc eq "abc"} values @{["ABC"]}' ABC
On v5.10 they all (except for the last one) give "ABC". The inverse case, first {uc eq "ABC"} keys %{{abc=>"abc"}}, also gives the "unexpected" result "ABC". Smells like a bug... could this be rt://96343?
In reply to Re: Strange behavior with List::Util qw{first} on perl >= 5.20
by Anonymous Monk
in thread Strange behavior with List::Util qw{first} on perl >= 5.20
by papioko
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |