in reply to scan, match and extract

Perhaps named references and using $+{foo} instead? Not getting a good direct link but search for “named capture group” in perlre e.g  (?<NAME>pattern), and %+ in perlvar.

Edit: Easier to get the direct link not on ipad: named capture groups.

The cake is a lie.
The cake is a lie.
The cake is a lie.