perl -<br>n (para cada linha do arquivo)<br>a (auto-split)<br>e &#39;push@array,$F[0]; (inclui o 1o elemento do array criado pelo auto-split)<br>END{print &quot;@array&quot;}&#39; arq.txt<br><br><div><span class="gmail_quote">Em 20/02/08, <b class="gmail_sendername">Fernando Oliveira</b> &lt;<a href="mailto:fernandocorrea@gmail.com">fernandocorrea@gmail.com</a>&gt; escreveu:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
q tal algo assim?<br>&lt;code&gt;<br>perl -nae &#39;push@array,$F[0];END{print &quot;@array&quot;}&#39; arq.txt<br>&lt;/code&gt;<br><br><div><span class="gmail_quote">Em 20/02/08, <b class="gmail_sendername">gabriel lima</b> &lt;<a href="mailto:gabriellima333@hotmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">gabriellima333@hotmail.com</a>&gt; escreveu:</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="e" id="q_118391e4eacf0ab8_1">




<div>
<span style="font-family: Courier New,Courier,Monospace;">Pessoal, estou com um problema que pode ser fácil de resolver para vocês.</span><br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;">Mas eu estou tendo um pouco de dificuldade para resolver o mesmo. Se alguem</span><br style="font-family: Courier New,Courier,Monospace;">

<span style="font-family: Courier New,Courier,Monospace;">me ajudar eu ficarei grato!</span><br style="font-family: Courier New,Courier,Monospace;"><br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;">Veja, tenho um arquivo .txt com o seguinte formato</span><br style="font-family: Courier New,Courier,Monospace;">

<br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;">63528&nbsp;&nbsp; Gabriel Lima</span><br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;">537728&nbsp; Outro Nome</span><br style="font-family: Courier New,Courier,Monospace;">

<span style="font-family: Courier New,Courier,Monospace;">645374&nbsp; Fulano De Tal</span><br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;">637485&nbsp; Beltrano Alvarenga</span><br style="font-family: Courier New,Courier,Monospace;">

<br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;">Eu gostaria de ler este arquivo e armazenar, apenas os número, em um $array[$i].<br>Observe que o primeiro número tem um digito a menos que os demais. Este número<br>

tem que ser armazena sem nenhuma espaço em branco, aliás, nenhum pode.<br><br>Para isso eu já tentei de tudo, expressões regulares, usar um while e ficar<br>dando chop até chegar nos números, mas nenhuma das minhas tentavivas deu certo.<br>

Aliás, minhas tacadas de Golf! (como dizem algumas pessoas aqui da lista) passaram<br>bem longe do &quot;buraco&quot;.<br><br>#!/usr/bin/perl<br><br>use strict;<br><br>my ($i, @array_emp, $linha);<br><br>&nbsp; # Abrindo arquivo para leitura<br>

open(EMP_LISTA, &quot;&lt; teste.txt&quot;) or die &quot;Erro ao abrir arquivo: $!&quot;;<br><br>&nbsp;&nbsp;&nbsp; while($linha &lt;EMP_LISTA&gt;){<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;  $i = 1;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;  $array_emp[$i] = $linha;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;  $i++;<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;  for($i = 0; $i &lt; 4; $i++){<br>

&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;  &nbsp;&nbsp;  print &quot;$array_emp[$i]\n&quot;;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;  }<br>&nbsp; # Fechando arquivo<br>close(EMP_LISTA);<br><br><br>Era mais ou menos algo como isso que eu estava tentando, mas<br>nem me lembro, escrevi rapido para vocês verem o caminho que <br>

eu estava tomando. Acho que está errado.<br><br>Até mais =/<br><br><br><br><br><br><br></span><br><hr>Conheça já o Windows Live Spaces, o site de relacionamentos do Messenger! <a href="http://www.amigosdomessenger.com.br" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">Crie já o seu!</a></div>


<br></span></div>_______________________________________________<br>
Rio-pm mailing list<br>
<a href="mailto:Rio-pm@pm.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">Rio-pm@pm.org</a><br>
<a href="http://mail.pm.org/mailman/listinfo/rio-pm" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://mail.pm.org/mailman/listinfo/rio-pm</a><br></blockquote></div><span class="sg"><br><br clear="all">
<br>-- <br>
[]&#39;s Fernando
</span></blockquote></div><br><br clear="all"><br>-- <br>[]&#39;s Fernando