<div><div>Olá Igor!<br><br>Valeu pelo seu código mas apenas mudei o meu para fazer a concatenação dos packeados com formatação &quot;f&quot; e escrever no arquivo assim como você descreveu. Funcionou certinho! Tão simples!
<br>&nbsp;</div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div style="">Acredito que uma primeira tentativa seria:<div><br></div><div>&lt;code&gt;
</div><div>use strict;</div><div>use warnings;</div><div><br></div><div>my @data = (</div><div>&nbsp; &nbsp; [ 0, 1, 2, 3, 4 ],&nbsp; &nbsp; # linha1</div><div>&nbsp; &nbsp; [ 0, 1, 2, 3, 4 ],&nbsp; &nbsp; # linha2</div><div>&nbsp; &nbsp; [ 0, 1, 2, 3, 4 ],&nbsp; &nbsp; # linhaN</div>
<div>);</div><div><br></div><div>my $binary_data;</div><div>for my $line (@data) {</div><div><br></div><div>&nbsp; &nbsp; # cria o pattern para o pack, baseado no numero</div><div>&nbsp; &nbsp; # de elementos que este possui. perldoc -f pack para
</div><div>&nbsp; &nbsp; # significado de &quot;f&quot;</div><div>&nbsp; &nbsp; my $pack_pattern = &quot;f&quot; x scalar @{$line};</div><div><br></div><div>&nbsp; &nbsp; # armazena o resultado do pack aplicado ao</div><div>&nbsp; &nbsp; # pattern acima, utilizando os elementos da
</div><div>&nbsp; &nbsp; # linha</div><div>&nbsp; &nbsp; $binary_data .= pack( $pack_pattern, @$line );</div><div>}</div><div>open my $fh, &quot;&gt;&quot;, &quot;/tmp/output.bin&quot; or die $!;</div><div>binmode($fh);</div><div>print $fh $binary_data;
</div><div>close $fh or warn $!;</div><div>&lt;/code&gt;</div><div><br></div><div>Veja se serve prá alguma coisa, ou chega perto :-)</div><span class="q"></span></div></blockquote></div><br clear="all"><br>-- <br>Henrique