... any regex ... either succeeds or it fails, so either all the match strings are defined, or none of them are.
A minor cavil: capture groups that are not required to match for an overall match will return undef in their respective $n capture variables and in list context.
The (?|pattern) construct available with Perl version 5.10 (see Extended Patterns in perlre) modifies this behavior in alternations, but you may still be left with undefs from other sources.c:\@Work\Perl\monks>perl -wMstrict -MData::Dump -le "my $s = 'abc'; ;; my @captures = $s =~ m{ (?: (a)(b)(c) | (w)(x)(y)) (z)? }xms; dd \@captures; " ["a", "b", "c", undef, undef, undef, undef]
c:\@Work\Perl\monks>perl -wMstrict -MData::Dump -le "use 5.010; ;; my $s = 'abc'; ;; my @captures = $s =~ m{ (?| (a)(b)(c) | (w)(x)(y)) (z)? }xms; dd \@captures; " ["a", "b", "c", undef]
Give a man a fish: <%-(-(-(-<
In reply to Re^2: Hurdle with summarizing results from complex data structure related to MySQL result handling
by AnomalousMonk
in thread Hurdle with summarizing results from complex data structure related to MySQL result handling
by hiyall
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |