in reply to Nested grouping or capturing inside capturing
Named back reference save your ($4 || $3), but I wonder this is elegant or not.
print "$1-$2-$+{third}\n" if m/ (\w+)\s (\w+)\s (?: "(?<third>[^"]+)" | (?<third>\w+)) /x;
|
---|
In Section
Seekers of Perl Wisdom