The block does get the topic, but the regex isn't executing immediately. Another way to get what you want, rather than mentioning the topic explicitly, is to use the m// form of match.
> grep { m/\.pl6/ }, <a.pl6 b.txt> (a.pl6) For sanity's sake, I would recommend writing your match-immediately regex like this everywhere as there's no potential ambiguity based on context. As to whether or not the behavior you observe is correct ... I tend to think that it is not correct. S05 says Specifically, a C</.../> matches immediately in a value context (sink, Boolean, string, or numeric), or when it is an explicit argument of a C<~~>. Otherwise it's a C<Regex> constructor identical to the explicit C<regex> form. The block is being evaulated in a boolean context, and I would expect that to propagate to the innards of the block which would put the regex in a boolean context. -Scott On Fri, Oct 2, 2015 at 1:50 PM, mt1957 <mt1...@gmail.com> wrote: > Hi Philip, > > Thanks for your answer. Seems that I've written it wrongly then. Doesn't > the block get the topic variable in the same way like map or can't the > block be used there at all? > > Greetings > Marcel > > Grep still accepts a regex, so `grep /\.pl6/, <a.pl6 b.txt>` does what you > want. > > On Fri, Oct 2, 2015 at 5:12 PM mt1957 < <mt1...@gmail.com>mt1...@gmail.com> > wrote: > >> Hi, >> noticed that grep doesn't accept a Match operation anymore >> In repl ... >> >> > grep { /\.pl6/ }, <a.pl6 b.txt> >> Method 'match' not found for invocant of class 'Any' >> >> Must now do explicitly match on the topic variable >> >> > grep { $_ ~~ /\.pl6/ }, <a.pl6 b.txt> >> (a.pl6) >> >> Is this change correct? >> >> perl6 version 2015.09-206-g8a195fa built on MoarVM version >> 2015.09-39-g1434283 >> >> Greets, >> Marcel >> > >