In Perl 6, =~ is the smart match operator. It does more than the Perl 5 version, which just binds something to a s///, m//, or tr//. It compares its two operands in a way that is most likely to be useful. when compares $_ to its argument using =~ to determine the condition.

=~ Operates according to the following table:

  $a    |    $b    |   $a =~ $b
 =======|==========|==============
 expr   |  list    | if $a =~ any($b)
 list   |  list*   | if any($a) =~ any($b)
 hash   |  sub(%)  | if $b(%$a)
 array  |  sub(@)  | if $b(@$a)
 expr   |  sub($)  | if $b($a)
 expr   |  sub()*  | if $b()
 hash   |  hash    | if grep {exists $a{$_}} %$b
 hash   |  array   | if grep {$a{$_}} @$b
 hash   |  regex   | if grep {/<$b>/} keys %$a
 hash   |  scalar  | if $a{$b}
 array  |  array   | if any(@$a) =~ any(@$b)
 array  |  regex   | if grep {/<$b>/} @$a
 array  |  number  | if $a$b
 array  |  expr    | if any(@$a) =~ $b
 object |  class   | if $a.isa $b
 object |  method  | if $a.$b()
 expr   |  regex   | if $a matches /<$b>/
 expr   |  number  | if $a == $b
 expr   |  string  | if $a eq $b
 expr   |  boolean*| if $b
 expr   |  undef   | unless defined $a

If these types cannot be determined at compile time, they are run time matched instead. Except in the cases marked with *, =~ commutes. any and all are superpositions.