On 4/2/07, Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote: Here are some further examples of what I want to do, the following example works now in re::engine::Plugin (not the one on cpan atm though): use re::engine::Plugin ( exec => sub { my ($re, $sv) = @_; $re->captures( sub { # Return a closure which alters the $sv sub { $$sv = shift }; } ); 1: # successful match } ); my $str = "eek"; if (\$str =~ /rw: blah blah/) { $1->( "ook" ); # $$str is now "ook" not "eek" } Doing C< $1->( "ook" ) > instead of C< $1 = "ook" > is a bit hackish though, so I'm going to propese something that'll make the baby dmq cry. Implement numbered captures ($1 ... ) as a tied SCALAR and %+ and %- as a tied HASH. This'll allow a smooth implementation of the p6 :rw modifier as well as some things I haven't thought of / mentioned yet.Thread Previous | Thread Next