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

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.

  • Comment on Re^3: smart match operator should be smarter!

Replies are listed 'Best First'.
Re^4: smart match operator should be smarter!
by ikegami (Patriarch) on Nov 21, 2009 at 19:00 UTC
    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?