that's IMHO the shortest and most intuitive
DB<35> $_='a' DB<36> ; /(a)/ or /(b)/; $x= $1 DB<37> p $x a DB<38> $_='b' DB<39> ; /(a)/ or /(b)/; $x= $1 DB<40> p $x b DB<41>
I'm aware you wanted the list assignment approach, but it's longer because you'd need to repeat ($x) = for each term and I prefer DRY idioms.
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
In reply to Re: capture value from two patterns
by LanX
in thread capture value from two patterns
by vitoco
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |