<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body class='hmmessage'>
<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 "buraco".<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, "&lt; teste.txt") or die "Erro ao abrir arquivo: $!";<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 "$array_emp[$i]\n";<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='_new'>Crie já o seu!</a></body>
</html>