<br><div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><span class="q"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>A variável $&amp; será populada com isso porque ela guarda o valor do<br>último match de uma expressão regular. Na prática, seu uso é<br>desaconselhado pois ela infere problemas de performance em todo o<br>aplicativo do seu uso pra frente.
</blockquote></span><div><br><span style="font-family: courier new,monospace;">Sério ? Eu não tinha este informação de performance... então não é aconcelhável utilizar o $&amp; nos programas ? Deve apenas fazer a atribuição &quot;my $a = $&amp;&quot; !
</span></div></div></blockquote><div><br><strong><span style="font-weight: bold;"><span style="font-weight: bold;">Lendo o perlre encontrei isto...</span></span><br>WARNING</strong>: Once Perl sees that you need one of <a href="file:///C:/Perl/html/lib/Pod/perlvar.html#item___">
<code>$&amp;</code></a>, <a href="file:///C:/Perl/html/lib/Pod/perlvar.html#item___"><code>$`</code></a>, or
<a href="file:///C:/Perl/html/lib/Pod/perlvar.html#item___"><code>$&#39;</code></a> anywhere in the program, it has to provide them for every
pattern match.  This may substantially slow your program.  Perl
uses the same mechanism to produce $1, $2, etc, so you also pay a
price for each pattern that contains capturing parentheses.  (To
avoid this cost while retaining the grouping behaviour, use the
extended regular expression <code>(?: ... )</code> instead.)  But if you never
use <a href="file:///C:/Perl/html/lib/Pod/perlvar.html#item___"><code>$&amp;</code></a>, <a href="file:///C:/Perl/html/lib/Pod/perlvar.html#item___"><code>$`</code></a> or <a href="file:///C:/Perl/html/lib/Pod/perlvar.html#item___">
<code>$&#39;</code></a>, then patterns <em>without</em> capturing
parentheses will not be penalized.  So avoid <a href="file:///C:/Perl/html/lib/Pod/perlvar.html#item___"><code>$&amp;</code></a>, <a href="file:///C:/Perl/html/lib/Pod/perlvar.html#item___"><code>$&#39;</code></a>, and <a href="file:///C:/Perl/html/lib/Pod/perlvar.html#item___">
<code>$`</code></a>
if you can, but if you can&#39;t (and some algorithms really appreciate
them), once you&#39;ve used them once, use them at will, because you&#39;ve
already paid the price.  As of 5.005, <a href="file:///C:/Perl/html/lib/Pod/perlvar.html#item___"><code>$&amp;</code></a> is not so costly as the
other two.&nbsp;</div></div><br>