in reply to global regex returning a list of arrays?
perlvar lists @- and @+, but you still need a while loop to capture them:
#!/usr/local/bin/perl use strict; use Data::Dumper; my $str = 'abacadabra'; my @matches; push @matches, [ map { substr $str, $-[$_], $+[$_]-$-[$_] } 1..$#+ ] while $str =~ /([ac])([bd])/g; print Dumper \@matches;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: global regex returning a list of arrays?
by LanX (Saint) on Feb 20, 2010 at 15:06 UTC | |
by AnomalousMonk (Archbishop) on Feb 20, 2010 at 17:04 UTC | |
by LanX (Saint) on Feb 20, 2010 at 21:28 UTC |