in reply to Re: smart match operator should be smarter!
in thread smart match operator should be smarter!

You must be using 5.10.0, where the implementation had many bugs.
  • Comment on Re^2: smart match operator should be smarter!

Replies are listed 'Best First'.
Re^3: smart match operator should be smarter!
by zwon (Abbot) on Nov 21, 2009 at 18:48 UTC

    Yes, I'm using 5.10.0 (from Ubuntu 9.10, so it's not exactly 5.10.0), but I doesn't see any bugs. It looks like it works as it should work.

      Fixing the aforementioned bugs required making ~~ non-commutative.

        Yup! Have tried this in 5.10.1 and now see the difference.

        use strict; use warnings; use 5.010; my @arr = (2, 5 , "aaa"); say "\@arr ~~ 5 matches" if @arr ~~ 5; say "5 ~~ \@arr matches" if 5 ~~ @arr; say "\@arr ~~ 3 matches" if @arr ~~ 3; __END__ 5 ~~ @arr matches

        But after reading "Smart matching in detail" from perlsyn I have the impression that @arr ~~ 3 expression falls under

        Any Num numeric equality $a == $b
        rule, so it should be equal to @arr == 3, and it's not, so what rule is actually applied in this case? And BTW is there any way to see what comparison have been actually performed?