<html><body>
<p>Valeu Thomas, brigadão mesmo.<br>
<br>
t+<br>
Diego<br>
<br>
<br>
.============================================.<br>
  Diego Mendes Teixeira   -  diegom@lcc.ufmg.br             <br>
  Desenvolvimento de Sistemas  -  LCC/CENAPAD<br>
  Universidade Federal de Minas Gerais - UFMG   <br>
  Cel: +55(31)8842-9951 - Tel(trab): +55(31)34994910       <br>
'============================================'<br>
<img src="cid:10__=0CBBF881DFF59B808f9e8a93df@grude.ufmg.br" width="16" height="16" alt="Inativo ocultar detalhes deThomas Britis &lt;thomas@tcnet.com.br&gt;">Thomas Britis &lt;thomas@tcnet.com.br&gt;<br>
<br>
<br>

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top"><td style="background-image:url(cid:20__=0CBBF881DFF59B808f9e8a93df@grude.ufmg.br); background-repeat: no-repeat; " width="40%">
<ul>
<ul>
<ul>
<ul><b><font size="2">Thomas Britis &lt;thomas@tcnet.com.br&gt;</font></b><font size="2"> </font><br>
<font size="2">Enviado Por: cascavel-pm-bounces+diegom=lcc.ufmg.br@pm.org</font>
<p><font size="2">25/10/2006 15:30</font>
<table border="1">
<tr valign="top"><td width="168" bgcolor="#FFFFFF"><div align="center"><font size="2">Favor responder a<br>
Cascavel Perl Mongers &lt;cascavel-pm@pm.org&gt;</font></div></td></tr>
</table>
</ul>
</ul>
</ul>
</ul>
</td><td width="60%">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top"><td width="1%" valign="middle"><img src="cid:30__=0CBBF881DFF59B808f9e8a93df@grude.ufmg.br" border="0" height="1" width="58" alt=""><br>
<div align="right"><font size="2">Para</font></div></td><td width="100%"><img src="cid:30__=0CBBF881DFF59B808f9e8a93df@grude.ufmg.br" border="0" height="1" width="1" alt=""><br>
<font size="2">Cascavel Perl Mongers &lt;cascavel-pm@pm.org&gt;</font></td></tr>

<tr valign="top"><td width="1%" valign="middle"><img src="cid:30__=0CBBF881DFF59B808f9e8a93df@grude.ufmg.br" border="0" height="1" width="58" alt=""><br>
<div align="right"><font size="2">cc</font></div></td><td width="100%"><img src="cid:30__=0CBBF881DFF59B808f9e8a93df@grude.ufmg.br" border="0" height="1" width="1" alt=""><br>
</td></tr>

<tr valign="top"><td width="1%" valign="middle"><img src="cid:30__=0CBBF881DFF59B808f9e8a93df@grude.ufmg.br" border="0" height="1" width="58" alt=""><br>
<div align="right"><font size="2">Assunto</font></div></td><td width="100%"><img src="cid:30__=0CBBF881DFF59B808f9e8a93df@grude.ufmg.br" border="0" height="1" width="1" alt=""><br>
<font size="2">Re: [Cascavel-pm] Manipulação de arquivo</font></td></tr>
</table>

<table border="0" cellspacing="0" cellpadding="0">
<tr valign="top"><td width="58"><img src="cid:30__=0CBBF881DFF59B808f9e8a93df@grude.ufmg.br" border="0" height="1" width="1" alt=""></td><td width="336"><img src="cid:30__=0CBBF881DFF59B808f9e8a93df@grude.ufmg.br" border="0" height="1" width="1" alt=""></td></tr>
</table>
</td></tr>
</table>
<br>
<tt>Leia a documentação do substr que você vai entender no ato.<br>
<br>
                 Se não entender, é só dizer.<br>
<br>
                 Abraços,<br>
<br>
Diego Mendes Teixeira wrote:<br>
&gt; Ficou bem bacana Thomas. Vou testar a noite quando eu chegar na facul. <br>
&gt; Mas eu fiquei meio confuso, pois tem expressoes que para um cara <br>
&gt; iniciante (e confesso, começando a gostar muito e interessar por perl) <br>
&gt; são novas.... queria entender mais detalhadamente o código. Como a <br>
&gt; expressao que voce usa no laço: &nbsp;((substr ($nome, $x, 1) eq substr ($_, <br>
&gt; $x, 1)) &amp;&amp; (substr($_, $x, 1) ne $delim))<br>
&gt; <br>
&gt; Brigadão ai pela ajuda.<br>
&gt; <br>
&gt; Diego<br>
&gt; <br>
&gt; <br>
&gt; .============================================.<br>
&gt; Diego Mendes Teixeira - diegom@lcc.ufmg.br<br>
&gt; Desenvolvimento de Sistemas - LCC/CENAPAD<br>
&gt; Universidade Federal de Minas Gerais - UFMG<br>
&gt; Cel: +55(31)8842-9951 - Tel(trab): +55(31)34994910<br>
&gt; '============================================'<br>
&gt; Inativo ocultar detalhes deThomas Britis &lt;thomas@tcnet.com.br&gt;Thomas <br>
&gt; Britis &lt;thomas@tcnet.com.br&gt;<br>
&gt; <br>
&gt; <br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *Thomas Britis &lt;thomas@tcnet.com.br&gt;*<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Enviado Por:<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cascavel-pm-bounces+diegom=lcc.ufmg.br@pm.org<br>
&gt; <br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 25/10/2006 14:39<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Favor responder a<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Cascavel Perl Mongers &lt;cascavel-pm@pm.org&gt;<br>
&gt; <br>
&gt;                  <br>
&gt; <br>
&gt; Para<br>
&gt;                  <br>
&gt; Cascavel Perl Mongers &lt;cascavel-pm@pm.org&gt;<br>
&gt; <br>
&gt; cc<br>
&gt;                  <br>
&gt; <br>
&gt; Assunto<br>
&gt;                  <br>
&gt; Re: [Cascavel-pm] Manipulação de arquivo<br>
&gt; <br>
&gt;                  <br>
&gt; <br>
&gt; <br>
&gt; Fiz um programa (meio porco) usando a estrutura que você estava usando<br>
&gt; no outro para comparação exata sem uso de expressão regular:<br>
&gt; <br>
&gt; my ($nome) = $ARGV[0] || die &quot;Uso: $0 [palavra] [arquivo]\n&quot;;<br>
&gt; my ($delim) = &quot;:&quot;; # Delimitador já que você só considera a primeira<br>
&gt; parte, correto?<br>
&gt; my ($linha);<br>
&gt; my ($achei) = 0;<br>
&gt; my ($x);<br>
&gt; <br>
&gt; open (F, &quot;&lt;/$ARGV[1]&quot;);<br>
&gt; while (&lt;F&gt;) {<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; $linha++;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; $x = 0;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; while ((substr ($nome, $x, 1) eq substr ($_, $x, 1)) &amp;&amp; (substr<br>
&gt; ($_, $x, 1) ne $delim)) { $x++; }<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; if ($x eq length ($nome)) {<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; print &quot;Achei em linha $linha\n&quot;;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $achei++;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; last;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; }<br>
&gt; }<br>
&gt; <br>
&gt; print &quot;Nao achei\n&quot; if (!$achei);<br>
&gt; <br>
&gt; -- <br>
&gt; Thomas Storino Britis<br>
&gt; TCNet Informatica e Telecomunicacoes LTDA<br>
&gt; _______________________________________________<br>
&gt; Cascavel-pm mailing list<br>
&gt; Cascavel-pm@pm.org<br>
&gt; </tt><tt><a href="http://mail.pm.org/mailman/listinfo/cascavel-pm">http://mail.pm.org/mailman/listinfo/cascavel-pm</a></tt><tt><br>
&gt; <br>
&gt; <br>
&gt; ------------------------------------------------------------------------<br>
&gt; <br>
&gt; _______________________________________________<br>
&gt; Cascavel-pm mailing list<br>
&gt; Cascavel-pm@pm.org<br>
&gt; </tt><tt><a href="http://mail.pm.org/mailman/listinfo/cascavel-pm">http://mail.pm.org/mailman/listinfo/cascavel-pm</a></tt><tt><br>
<br>
-- <br>
Thomas Storino Britis<br>
TCNet Informatica e Telecomunicacoes LTDA<br>
_______________________________________________<br>
Cascavel-pm mailing list<br>
Cascavel-pm@pm.org<br>
</tt><tt><a href="http://mail.pm.org/mailman/listinfo/cascavel-pm">http://mail.pm.org/mailman/listinfo/cascavel-pm</a></tt><tt><br>
</tt><br>
</body></html>