<div><div>Of course, if you're not going to use backreferencing ($1, $2, etc) with those parens, you'll probably want to turn off the backreferencing with ?: inside the parens; no need to create backreferences if you're not going to use 'em:
<br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">foreach (qw(AAXXBB AAYBB AAXYBB AAYBB AYBB)) {<br> printf("%-7s", $_);
<br> print (($_ =~ /^AA(XX|Y)BB$/) ? "yes " : "no ");<br> print (($_ =~ /^AAXX|YBB$/) ? "yes " : "no ");<br> print "\n";<br>}<br><br>$ perl j.pl<br>AAXXBB yes yes
<br>AAYBB yes yes<br>AAXYBB no yes<br>AAYBB yes yes<br>AYBB no yes</blockquote><div><br>$ cat x.pl<br><br>foreach (qw(AAXXBB AAYBB AAXYBB AAYBB AYBB)) <br>{<br> printf("%-7s", $_);<br> print (($_ =~ /^AA(?:XX|Y)BB$/) ? "yes " : "no ");
<br> print (($_ =~ /^AAXX|YBB$/) ? "yes " : "no ");<br> print "\n";<br>} </div><br>AAXXBB yes yes<br>AAYBB yes yes<br>AAXYBB no yes<br>AAYBB yes yes<br>AYBB no yes<br><br>
<br>-- b<br><br></div>