Good question. The answer is to use the magic $+ vaiable:
while( <DATA> ) { chomp; my ( $data ) = m/TAG:(\"([^\"]+)\"|([^\"\s]+))/ ? $+ : 'not_def'; print "$_ => $data\n"; }
In reply to Re: Alternation in pattern matches
by ambrus
in thread Alternation in pattern matches
by guha
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |