good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: Looking for alternative syntax for assigning variables based on regex matchesby rsFalse (Chaplain) |
on Mar 02, 2021 at 10:28 UTC ( [id://11129009]=note: print w/replies, xml ) | Need Help?? |
With non-destructive /r modifier (and lookahead): OUTPUT: And if you want only to use your capture, just: In the later example a value of $foo didn't change. *Updated +one more way: Though it looks like bad practice to change a variable while it is in use.
In Section
Seekers of Perl Wisdom
|
|