[Purdue-pm] Perl 6 regex question

Mark Senn mark at purdue.edu
Sat Jan 24 18:38:59 PST 2009

The following match regex works as expected
    $s ~~ m/
        (abc)  # match and capture as $0
        (def)  # match and capture as $1
        .+?    # match one or more characters
        $1     # match previously captured $1
        $0     # match previously captured $0

I don't know if the following can be done with
    % p6 --version
    This is Rakudo Perl 6, revision 0 built on parrot 0.8.1
    for x86_64-linux-thread-multi.
    Copyright 2006-2008, The Perl Foundation.

I'd like to change the regex to do the following.

Instead of (abc) I'd like to have $a to be 'abc'
and use $a instead of 'abc'.

Instead of $1 I'd like to have it match $1 but
with the characters in reverse order.

Any hints?


More information about the Purdue-pm mailing list