Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6372873
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:17:34+00:00 2026-05-25T01:17:34+00:00

I think none subroutine from List::MoreUtils does not act as described. According to documentation,

  • 0

I think none subroutine from List::MoreUtils does not act as described. According to documentation,

none BLOCK LIST Logically the negation of any. Returns a true value if
no item in LIST meets the criterion given through BLOCK, or if LIST
is empty
. Sets $_ for each item in LIST in turn

Now, try:

use strict;
use warnings;
use 5.012;
use List::MoreUtils qw(none);

my @arr = ( 1, 2, 3 );
if ( none { $_ == 5 } @arr ) {
    say "none of the elements in arr equals 5";
}
else {
    say "some element in arr equals 5";
}

works OK, but replace @arr with an empty one (my @arr = (); or simply my @arr;) and you get a wrong answer.

What’s going on?

update: i had List::MoreUtils ver 0.22. Updated to the latest and it seems OK. Weird though!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T01:17:35+00:00Added an answer on May 25, 2026 at 1:17 am

    The documentation is in line with the v 0.33 pure Perl implementation. The reason why it failed was because the implementation changed between versions 0.22 and 0.33.

    In v 0.33, if @array is empty, the for loop will not execute, so YES will be returned.

    Here are the two versions side-by-side:

    # v 0.33                      |  # v 0.22
    ------------------------------+----------------------------------------
    sub none (&@) {               |  sub none (&@) {
        my $f = shift;            |      my $f = shift;
        foreach ( @_ ) {          |      return if ! @_;          # root cause
            return NO if $f->();  |      for (@_) {
        }                         |          return 0 if $f->();
        return YES;               |      }
    }                             |      return 1;
                                  |  }
    

    MetaCPAN also provides a comprehensive diff between versions 0.22 and 0.33

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Although I think that I did it before successfully, but this code does not
Weird question I think its more of I am not sure what it is
I'm referring to monitors as described here: http://en.wikipedia.org/wiki/Monitor_(synchronization) None of the definitions here seem
function classInfo(e){ document.getElementById('classRight').setAttribute('display','none'); alert(e); } I think this code is very straightforward bit it's
Not solved but I think the problem is something else and not the css
I've tried just about every relative path that I can think of, and none
(I've seen similar questions, but I think none of them cater to my specific
I think similar questions have been answered, but none really seem to have helped
I think that my issue should be really simple, yet I can not find
I think I could use .next on this, not sure, if there's a better

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.