<!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> </DIV>
<DIV><FONT face="Trebuchet MS" size=2>não compreendi o
<resultado></resultado></FONT></DIV>
<DIV><FONT face="Trebuchet MS" size=2></FONT> </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> </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> </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"><code><BR>use Benchmark
qw(:all) ;<BR>my $var = 'parlamentarismo';<BR><BR>cmpthese(-1,
{<BR>
'array' => <A href="mailto:'@{[$var">'@{[$var</A> =~ /a/g]}',
<BR> 'while'
=> 'while ( $var =~ /a/g ) {
$qtd02++}',<BR>
'tr' => '$var =~
y/a/A/'<BR>
});<BR style="FONT-FAMILY: courier new,monospace"></SPAN><SPAN
style="FONT-FAMILY: courier new,monospace"></code><BR><BR
style="FONT-FAMILY: courier new,monospace"></SPAN><SPAN
style="FONT-FAMILY: courier new,monospace"><resultado></SPAN><BR
style="FONT-FAMILY: courier new,monospace"><SPAN
style="FONT-FAMILY: courier new,monospace">
Rate array while tr</SPAN><BR
style="FONT-FAMILY: courier new,monospace"><SPAN
style="FONT-FAMILY: courier new,monospace">array 1090778/s
-- -54% -71% </SPAN><BR
style="FONT-FAMILY: courier new,monospace"><SPAN
style="FONT-FAMILY: courier new,monospace">while 2388776/s
119% -- -37%</SPAN><BR
style="FONT-FAMILY: courier new,monospace"><SPAN
style="FONT-FAMILY: courier new,monospace">tr
3781862/s 247% 58% --</SPAN><BR
style="FONT-FAMILY: courier new,monospace"><SPAN
style="FONT-FAMILY: courier new,monospace"></resultado><BR><BR
style="FONT-FAMILY: courier new,monospace"></SPAN>
<DIV class=gmail_quote>On Nov 20, 2007 3:15 PM, Adriano Ferreira <<A
href="mailto:a.r.ferreira@gmail.com">a.r.ferreira@gmail.com</A>> 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, <<A
href="mailto:fernandolouis@terra.com.br">fernandolouis@terra.com.br</A>>
wrote:<BR>><BR>><BR>> Dae Pessoal... olha só...<BR>><BR>>
$variavel = "casa"; <BR>> Como faço pra contar quantos "a" tem em
$variavel?<BR>> Tentei o seguinte, mas não fucionou:<BR>> $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>><BR>> []s,<BR>> Fernando<BR>
<DIV>
<DIV></DIV>
<DIV class=Wj3C7c>> _______________________________________________
<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>><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>