in reply to Re^2: global regex returning a list of arrays?
in thread global regex returning a list of arrays?
hmm not as easy as I thought
$a=join " ",0..7; sub fold (&) { my @a; push @a, [$1,$2] while $_[0]->(); @a}; print Dumper fold { $a =~/(\w) (\w)/g };
seems like $1,$2 can't leave the scope of the coderef...
Cheers Rolf
UPDATE: c&p error in code
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: global regex returning a list of arrays?
by AnomalousMonk (Archbishop) on Feb 21, 2010 at 06:25 UTC |