in reply to using smartmatch for range matching

There is  1416 <= $number <= 1494 in later perls.

Replies are listed 'Best First'.
Re^2: using smartmatch for range matching
by LanX (Saint) on Nov 25, 2023 at 18:10 UTC
    IMHO it's also MUCH more efficient than the smartmatch, which will check against every element of a potentially huge temporary array, instead of just the boundaries.

    Edit

    And certainly better readable.

    Saying so, having an in LIST operator wouldn't harm, but that's not the demonstrated use case.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    see Wikisyntax for the Monastery

      Sorry, but this sticks out like a sore thumb!

      And certainly better readable.

      Either:

      And certainly better readability.

      Or maybe:

      And certainly more readable.

             :-)
      
      Naked blocks are fun! -- Randal L. Schwartz, Perl hacker
        Broken English is the most spoken language in the world. Better adapt! ;p

        Funny enough, I literally just read a discussion in the guardian where a bunch of Brits were discussing how easy English supposedly was.

        The less languages they knew, the more confident they were ... xD

        Cheers Rolf
        (addicted to the Perl Programming Language :)
        see Wikisyntax for the Monastery

        PS: "He who learns a new language acquires a new soul" - Czech proverb(?)

Re^2: using smartmatch for range matching
by perltux (Monk) on Nov 25, 2023 at 18:19 UTC
    Thank you, that's a good alternative, but i will have to figure out the minimum Perl version required to use this, does anyone know when it was introduced?

      perl5320delta