On Thu, Jul 13, 2006 at 15:44:33 -0400, Aaron Sherman wrote: > Now, let's look at some of the good that ~~ does for us: > > $a ~~ "Some string" # sameness > $a ~~ 5 # sameness > $a ~~ ->{...} # test > $a ~~ /.../ # regex matching > > That's great, and we don't want to mess with any of it. > > But, then we have: > > $a ~~ $b # uh... something
One compelling reason to have them behave exactly the same is to allow refactoring. If i'm using the same pattern on several inputs i'd like to maybe delegate this to a helper sub that will actually run the ~~ for me, in some way, and i'd like 100% compatibility. Also, sometimes i am matching on behalf of my caller, this is very common in dispatch algorithms, or things like tree visitors: my @list = $tree.filter_children( $match ); # very generic and useful -- Yuval Kogman <[EMAIL PROTECTED]> http://nothingmuch.woobling.org 0xEBD27418
pgp8KEQiTHBTj.pgp
Description: PGP signature