On Fri Feb 12 08:33:56 2016, m...@boris-moebus.de wrote:
> Version
> >>perl -v
> This is Rakudo version 2016.01.1 built on MoarVM version 2016.01
> implementing Perl 6.c.
> 
> Behaviour:
> > say so 'abc' ~~ / (\w+) . /;
> True
> > $0
> ?ab?
> 
> Should be (last two lines):
> >$0
> ab
> 
The behavior is correct, but if you're actually seeing question marks then it 
may be whatever font you're using is missing the HALFWIDTH LEFT CORNER BRACKET 
and HALFWIDTH RIGHT CORNER BRACKET characters (or some other terminal Unicode 
issue, perhaps). For me it looks like this:

> say so 'abc' ~~ / (\w+) . /;
True
> $0
「ab」

Which I hope the ticket system will not mangle. :-) It's worth noting that 
captures in Perl 6 are not just a string, but rather a Match object that 
represents structure:

> say so 'abc' ~~ / (\w(\w)) . /;
True
> $0
「ab」
 0 => 「b」

The REPL defaults to the .gist of the Match object, but if you coerce it to a 
string (which happens automatically when doing things just as concatenation, 
interpolation, etc.) then you'll get a string representing the matched 
characters:

> say so 'abc' ~~ / (\w+) . /;
True
> $0.Str
ab
> ~$0
ab

Hope this helps,

/jnthn

Reply via email to