I just reread the table of smart matches in Synopsis 4, and I realized
that it doesn't say what is returned by a ~~ b.  For example, the first line
of this table says

 

  $_      $x        Type of Match Implied    Matching Code

    ======  =====     =====================    =============

    Any     Code<$>   scalar sub truth         match if $x($_)

 

This is fine when $_ ~~ $x is called in boolean context.  But what if the
smart match operator is called in array or list context?   Does 

$_ ~~ $x 

then return the result of $x($_)?  I would expect that it does. After all,
in Perl 5, the expression 

   $string =~ /(a+)(b+)/ 

returns a list of captured substrings in list context

 

 

Joe Gottman

 



Reply via email to