Don't capture into a single set of parens; use a set for each chunk you want distinguishable and then look in @- and figure out which one matched.
$ perl -MYAML::Syck=Dump -le '$_="fum";/(fee)|(fie)|(foe)|(fum)/;print + Dump( \@- );print "paren ", grep( defined $-[$_], 1..4), " matched"' --- - 0 - ~ - ~ - ~ - 0 paren 4 matched
The cake is a lie.
The cake is a lie.
The cake is a lie.
In reply to Re: Determining which pattern matched
by Fletch
in thread Determining which pattern matched
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |