<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6000.16544" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face="Trebuchet MS" size=2>Amigo,</FONT></DIV>
<DIV><FONT face="Trebuchet MS" size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="Trebuchet MS" size=2>não compreendi o 
&lt;resultado&gt;&lt;/resultado&gt;</FONT></DIV>
<DIV><FONT face="Trebuchet MS" size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="Trebuchet MS" size=2>o que exatamente siginifcam os valores? E 
pra que serve o "Benchmark"?</FONT></DIV>
<DIV><FONT face="Trebuchet MS" size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="Trebuchet MS" size=2>[]s,</FONT></DIV>
<DIV><FONT face="Trebuchet MS" size=2>Fernando</FONT></DIV>
<DIV><FONT face="Trebuchet MS" size=2></FONT>&nbsp;</DIV>
<BLOCKQUOTE 
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
  <DIV 
  style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B> 
  <A title=shonorio@gmail.com href="mailto:shonorio@gmail.com">Solli Honorio</A> 
  </DIV>
  <DIV style="FONT: 10pt arial"><B>To:</B> <A title=cascavel-pm@pm.org 
  href="mailto:cascavel-pm@pm.org">Cascavel Perl Mongers</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>Sent:</B> Tuesday, November 20, 2007 6:28 
  PM</DIV>
  <DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [Cascavel-pm] Contando 
  caractares</DIV>
  <DIV><BR></DIV><SPAN style="FONT-FAMILY: courier new,monospace">Não resisti, 
  que tal um golfe ?</SPAN><BR style="FONT-FAMILY: courier new,monospace"><BR 
  style="FONT-FAMILY: courier new,monospace"><SPAN 
  style="FONT-FAMILY: courier new,monospace">$q=$v=~y/a//;</SPAN><BR 
  style="FONT-FAMILY: courier new,monospace"><BR 
  style="FONT-FAMILY: courier new,monospace"><SPAN 
  style="FONT-FAMILY: courier new,monospace">... e tem outra coisa, o 'tr' ou 
  'y' é mais rápido ... </SPAN><BR 
  style="FONT-FAMILY: courier new,monospace"><SPAN 
  style="FONT-FAMILY: courier new,monospace">&lt;code&gt;<BR>use Benchmark 
  qw(:all) ;<BR>my $var&nbsp;&nbsp; = 'parlamentarismo';<BR><BR>cmpthese(-1, 
  {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  'array' =&gt; <A href="mailto:'@{[$var">'@{[$var</A> =~ /a/g]}', 
  <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'while' 
  =&gt; 'while ( $var =~ /a/g ) { 
  $qtd02++}',<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  'tr'&nbsp;&nbsp;&nbsp; =&gt; '$var =~ 
  y/a/A/'<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  });<BR style="FONT-FAMILY: courier new,monospace"></SPAN><SPAN 
  style="FONT-FAMILY: courier new,monospace">&lt;/code&gt;<BR><BR 
  style="FONT-FAMILY: courier new,monospace"></SPAN><SPAN 
  style="FONT-FAMILY: courier new,monospace">&lt;resultado&gt;</SPAN><BR 
  style="FONT-FAMILY: courier new,monospace"><SPAN 
  style="FONT-FAMILY: courier new,monospace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  Rate array while&nbsp;&nbsp;&nbsp; tr</SPAN><BR 
  style="FONT-FAMILY: courier new,monospace"><SPAN 
  style="FONT-FAMILY: courier new,monospace">array 1090778/s&nbsp;&nbsp;&nbsp; 
  --&nbsp; -54%&nbsp; -71% </SPAN><BR 
  style="FONT-FAMILY: courier new,monospace"><SPAN 
  style="FONT-FAMILY: courier new,monospace">while 2388776/s&nbsp; 
  119%&nbsp;&nbsp;&nbsp; --&nbsp; -37%</SPAN><BR 
  style="FONT-FAMILY: courier new,monospace"><SPAN 
  style="FONT-FAMILY: courier new,monospace">tr&nbsp;&nbsp;&nbsp; 
  3781862/s&nbsp; 247%&nbsp;&nbsp; 58%&nbsp;&nbsp;&nbsp; --</SPAN><BR 
  style="FONT-FAMILY: courier new,monospace"><SPAN 
  style="FONT-FAMILY: courier new,monospace">&lt;/resultado&gt;<BR><BR 
  style="FONT-FAMILY: courier new,monospace"></SPAN>
  <DIV class=gmail_quote>On Nov 20, 2007 3:15 PM, Adriano Ferreira &lt;<A 
  href="mailto:a.r.ferreira@gmail.com">a.r.ferreira@gmail.com</A>&gt; wrote:<BR>
  <BLOCKQUOTE class=gmail_quote 
  style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
    <DIV>
    <DIV></DIV>
    <DIV class=Wj3C7c>On Nov 20, 2007 9:35 AM, &nbsp;&lt;<A 
    href="mailto:fernandolouis@terra.com.br">fernandolouis@terra.com.br</A>&gt; 
    wrote:<BR>&gt;<BR>&gt;<BR>&gt; Dae Pessoal... olha só...<BR>&gt;<BR>&gt; 
    $variavel = "casa"; <BR>&gt; Como faço pra contar quantos "a" tem em 
    $variavel?<BR>&gt; Tentei o seguinte, mas não fucionou:<BR>&gt; $qtd = 
    $variavel =~ m /a/g;<BR><BR></DIV></DIV>Se o que você quer é apenas contar 
    caracteres, use tr// <BR><BR>$qtd = $variavel =~ tr/a/a/;<BR><BR>Leia sobre 
    o operator em "perldoc perlop" e sobre este uso em 
    particular.<BR><BR>&gt;<BR>&gt; []s,<BR>&gt; Fernando<BR>
    <DIV>
    <DIV></DIV>
    <DIV class=Wj3C7c>&gt; _______________________________________________ 
    <BR>&gt; Cascavel-pm mailing list<BR>&gt; <A 
    href="mailto:Cascavel-pm@pm.org">Cascavel-pm@pm.org</A><BR>&gt; <A 
    href="http://mail.pm.org/mailman/listinfo/cascavel-pm" 
    target=_blank>http://mail.pm.org/mailman/listinfo/cascavel-pm 
    </A><BR>&gt;<BR>_______________________________________________<BR>Cascavel-pm 
    mailing list<BR><A 
    href="mailto:Cascavel-pm@pm.org">Cascavel-pm@pm.org</A><BR><A 
    href="http://mail.pm.org/mailman/listinfo/cascavel-pm" 
    target=_blank>http://mail.pm.org/mailman/listinfo/cascavel-pm</A><BR></DIV></DIV></BLOCKQUOTE></DIV><BR><BR 
  clear=all><BR>-- <BR>"o animal satisfeito dorme". - Guimarães Rosa 
  <P>
  <HR>

  <P></P>_______________________________________________<BR>Cascavel-pm mailing 
  list<BR>Cascavel-pm@pm.org<BR>http://mail.pm.org/mailman/listinfo/cascavel-pm</BLOCKQUOTE></BODY></HTML>