Regexp capture group list

Philip Newton philip.newton at gmail.com
Tue Nov 10 14:11:04 GMT 2009


On Tue, Nov 10, 2009 at 14:51, Paul LeoNerd Evans
<leonerd at leonerd.org.uk> wrote:
> So how about
>
>  my @matches = $_[0] =~ m/^$re/ or die ....;
>  substr( $_[0], 0, $+[0] ) = "";
>
>  return @matches;
>
> I think I like that...

Ooh, yes, it does have a certain charm. And it may even involve less
string copying -- I don't know whether s/^.....// is optimised to do
that, but AFAIK substr( ..., 0, ... ) = "" will simply set the
internal OFFSET flag in the SV.

Cheers,
Philip
-- 
Philip Newton <philip.newton at gmail.com>



More information about the london.pm mailing list