in reply to Getting a list of captures in Perl 5.10

splice!

use Data::Dumper; my $string = 'bla bla [[en:English]][[de:German]][[ga:Irish]] bla bla' +; my $groups = 2; my @tmp = ($string =~ m/\[\[(en|de|ga):(.+?)\]\]/g); my @matches; push @matches, [splice @tmp, 0, $groups] while @tmp; print Dumper \@matches; $groups = 3; @tmp = ($string =~ m/\[\[(en|de|ga):(.)(.+?)\]\]/g); @matches = (); push @matches, [splice @tmp, 0, $groups] while @tmp; print Dumper \@matches;

Good Day,
    Dean