Indeed. Using a package global instead of a lexical makes everything right as rain:
(I should have realized...)c:\@Work\Perl\monks>perl -wMstrict -le "print qq{perl version: $]}; ;; for my $string (qw(ab1b2b3b4d ab5b6b7d ab8b9d abxd ad)) { local our @two; my @matches = $string =~ /(a) (?: (b.) (?{ push @two, $2 }))+ (d)/x; print qq{'$string' -> all:(@matches) -> 2:(@two)}; } " perl version: 5.014004 'ab1b2b3b4d' -> all:(a b4 d) -> 2:(b1 b2 b3 b4) 'ab5b6b7d' -> all:(a b7 d) -> 2:(b5 b6 b7) 'ab8b9d' -> all:(a b9 d) -> 2:(b8 b9) 'abxd' -> all:(a bx d) -> 2:(bx) 'ad' -> all:() -> 2:()
Give a man a fish: <%-{-{-{-<
In reply to Re^8: Regex troubles...
by AnomalousMonk
in thread Regex troubles...
by kepler
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |