in reply to Do a named regex group in 5.8?
Another pre-5.10 approach is returning the list of capture group contents from the regex in list context and assigning directly to named variables:
Of course, this doesn't give you the \g{X} etc. backreference capabilities, but that's life.c:\@Work\Perl\monks>perl -wMstrict -le "my $s = 'xxx foo , 987;-+--++-+%yyy'; ;; my $sep = qr{ \s* [,;] \s* }xms; ;; my ($letters, $digits, $signs) = $s =~ m{ ([a-z]+) $sep (\d+) $sep ([-+]+) }xms; print qq{letters '$letters' digits '$digits' signs '$signs'}; " letters 'foo' digits '987' signs '-+--++-+'
Give a man a fish: <%-{-{-{-<
|
---|